/// ------------------------------------------------------------------------------------ /// <summary> /// Determine string correlation between the two given strings. /// </summary> /// <param name="stringCurr">current string</param> /// <param name="stringRev">revision string</param> /// <param name="charPropEngine">The character property engine used to determine whether /// the characters in the paragraph are digits or punctuation (and therefore need to /// be removed).</param> /// <returns> /// correlation factor between stringCurr and stringRev /// </returns> /// ------------------------------------------------------------------------------------ public static double DetermineStringCorrelation(string stringCurr, string stringRev, ILgCharacterPropertyEngine charPropEngine) { ParagraphCorrelation pc = new ParagraphCorrelation(stringCurr, stringRev, charPropEngine); return(pc.CorrelationFactor); }
public void CorrelationFactor_WithDigitsAndPunc() { ParagraphCorrelation pc = new ParagraphCorrelation("Hello!", "2Hello."); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello", "Hello, there"); Assert.AreEqual(0.5, pc.CorrelationFactor); pc = new ParagraphCorrelation("3Hello over there", "Hello over here"); Assert.AreEqual(0.5, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello there?", "4there Hello!"); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("5I am really excited!", "6I am really really really really excited."); Assert.AreEqual(0.8125, pc.CorrelationFactor); }
public void CorrelationFactor() { ILgCharacterPropertyEngine engine = LgIcuCharPropEngineClass.Create(); ParagraphCorrelation pc = new ParagraphCorrelation("Hello", "Hello", engine); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello", "Hello ", engine); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation(" Hello", "Hello", engine); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello", "Hello there", engine); Assert.AreEqual(0.5, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello over there", "Hello over here", engine); Assert.AreEqual(0.5, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello there", "there Hello", engine); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("I am really excited", "I am really really really really excited", engine); Assert.AreEqual(0.8125, pc.CorrelationFactor); pc = new ParagraphCorrelation(string.Empty, "What will happen here?", engine); Assert.AreEqual(0.0, pc.CorrelationFactor); pc = new ParagraphCorrelation(string.Empty, string.Empty, engine); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation(null, null, engine); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation(null, "what?", engine); Assert.AreEqual(0.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("what?", null, engine); Assert.AreEqual(0.0, pc.CorrelationFactor); }
public void CorrelationFactor_WithDigitsAndPunc() { ILgCharacterPropertyEngine engine = LgIcuCharPropEngineClass.Create(); ParagraphCorrelation pc = new ParagraphCorrelation("Hello!", "2Hello.", engine); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello", "Hello, there", engine); Assert.AreEqual(0.5, pc.CorrelationFactor); pc = new ParagraphCorrelation("3Hello over there", "Hello over here", engine); Assert.AreEqual(0.5, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello there?", "4there Hello!", engine); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("5I am really excited!", "6I am really really really really excited.", engine); Assert.AreEqual(0.8125, pc.CorrelationFactor); }
public void CorrelationFactor() { ILgCharacterPropertyEngine engine = LgIcuCharPropEngineClass.Create(); ParagraphCorrelation pc = new ParagraphCorrelation("Hello", "Hello", engine); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello", "Hello ", engine); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation(" Hello", "Hello", engine); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello", "Hello there", engine); Assert.AreEqual(0.5, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello over there", "Hello over here", engine); Assert.AreEqual(0.5, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello there", "there Hello", engine); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("I am really excited", "I am really really really really excited", engine); Assert.AreEqual(0.8125, pc.CorrelationFactor); pc = new ParagraphCorrelation(string.Empty, "What will happen here?", engine); Assert.AreEqual(0.0, pc.CorrelationFactor); pc = new ParagraphCorrelation(string.Empty, string.Empty, engine); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation(null, null, engine); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation(null, "what?", engine); Assert.AreEqual(0.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("what?", null, engine); Assert.AreEqual(0.0, pc.CorrelationFactor); }
public void CorrelationFactor_WithDigitsAndPunc() { ILgCharacterPropertyEngine engine = LgIcuCharPropEngineClass.Create(); ParagraphCorrelation pc = new ParagraphCorrelation("Hello!", "2Hello.", engine); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello", "Hello, there", engine); Assert.AreEqual(0.5, pc.CorrelationFactor); pc = new ParagraphCorrelation("3Hello over there", "Hello over here", engine); Assert.AreEqual(0.5, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello there?", "4there Hello!", engine); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("5I am really excited!", "6I am really really really really excited.", engine); Assert.AreEqual(0.8125, pc.CorrelationFactor); }
public void CorrelationFactor() { ParagraphCorrelation pc = new ParagraphCorrelation("Hello", "Hello"); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello", "Hello "); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation(" Hello", "Hello"); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello", "Hello there"); Assert.AreEqual(0.5, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello over there", "Hello over here"); Assert.AreEqual(0.5, pc.CorrelationFactor); pc = new ParagraphCorrelation("Hello there", "there Hello"); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("I am really excited", "I am really really really really excited"); Assert.AreEqual(0.8125, pc.CorrelationFactor); pc = new ParagraphCorrelation(string.Empty, "What will happen here?"); Assert.AreEqual(0.0, pc.CorrelationFactor); pc = new ParagraphCorrelation(string.Empty, string.Empty); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation(null, null); Assert.AreEqual(1.0, pc.CorrelationFactor); pc = new ParagraphCorrelation(null, "what?"); Assert.AreEqual(0.0, pc.CorrelationFactor); pc = new ParagraphCorrelation("what?", null); Assert.AreEqual(0.0, pc.CorrelationFactor); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Determine string correlation between the two given strings. /// </summary> /// <param name="stringCurr">current string</param> /// <param name="stringRev">revision string</param> /// <param name="charPropEngine">The character property engine used to determine whether /// the characters in the paragraph are digits or punctuation (and therefore need to /// be removed).</param> /// <returns> /// correlation factor between stringCurr and stringRev /// </returns> /// ------------------------------------------------------------------------------------ public static double DetermineStringCorrelation(string stringCurr, string stringRev, ILgCharacterPropertyEngine charPropEngine) { ParagraphCorrelation pc = new ParagraphCorrelation(stringCurr, stringRev, charPropEngine); return pc.CorrelationFactor; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Determine string correlation between the two given strings. /// </summary> /// <param name="stringCurr">current string</param> /// <param name="stringRev">revision string</param> /// <returns> /// correlation factor between stringCurr and stringRev /// </returns> /// ------------------------------------------------------------------------------------ public static double DetermineStringCorrelation(string stringCurr, string stringRev) { ParagraphCorrelation pc = new ParagraphCorrelation(stringCurr, stringRev); return(pc.CorrelationFactor); }