@Test public void normalizeLaugh() throws Exception { Assert.assertEquals("ahahah", normalizer.normalize("ahahahah")); Assert.assertEquals("haha", normalizer.normalize("hahha")); Assert.assertEquals("haha", normalizer.normalize("hahaa")); Assert.assertEquals("ahaha", normalizer.normalize("ahahahahhahahhahahaaaa")); Assert.assertEquals("jaja", normalizer.normalize("jajjajajaja")); }
public CharSequence normalize (CharSequence text) { String modified = HASH_USER_REGEX.matcher(text).replaceAll(" "); modified = RT_REGEX.matcher(modified).replaceAll(" "); modified = FACE_REGEX.matcher(modified).replaceAll(" "); modified = LAUGH_REGEX.matcher(modified).replaceAll("$1$2$1$2"); return modified; }
TwitterCharSequenceNormalizer implements CharSequenceNormalizer { public CharSequence normalize (CharSequence text) { String modified = HASH_USER_REGEX.matcher(text).replaceAll(" "); modified = RT_REGEX.matcher(modified).replaceAll(" "); modified = FACE_REGEX.matcher(modified).replaceAll(" "); modified = LAUGH_REGEX.matcher(modified).replaceAll("$1$2$1$2"); return modified; } }
TwitterCharSequenceNormalizer implements CharSequenceNormalizer { public CharSequence normalize (CharSequence text) { String modified = HASH_USER_REGEX.matcher(text).replaceAll(" "); modified = RT_REGEX.matcher(modified).replaceAll(" "); modified = FACE_REGEX.matcher(modified).replaceAll(" "); modified = LAUGH_REGEX.matcher(modified).replaceAll("$1$2$1$2"); return modified; }  }
TwitterCharSequenceNormalizer implements CharSequenceNormalizer { public CharSequence normalize (CharSequence text) { String modified = HASH_USER_REGEX.matcher(text).replaceAll(" "); modified = RT_REGEX.matcher(modified).replaceAll(" "); modified = FACE_REGEX.matcher(modified).replaceAll(" "); modified = LAUGH_REGEX.matcher(modified).replaceAll("$1$2$1$2"); return modified; }  static TwitterCharSequenceNormalizer getInstance(); CharSequence normalize(CharSequence text); }
TwitterCharSequenceNormalizer implements CharSequenceNormalizer { public CharSequence normalize (CharSequence text) { String modified = HASH_USER_REGEX.matcher(text).replaceAll(" "); modified = RT_REGEX.matcher(modified).replaceAll(" "); modified = FACE_REGEX.matcher(modified).replaceAll(" "); modified = LAUGH_REGEX.matcher(modified).replaceAll("$1$2$1$2"); return modified; }  static TwitterCharSequenceNormalizer getInstance(); CharSequence normalize(CharSequence text);  }