Skip to content

Emoticon Detector in Java. Given string identifies emojis present optimizely. Could be used for any keyword matching. i.e., Emoji Detector.

Notifications You must be signed in to change notification settings

yogin16/emoticon-detect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

emoticon-detect

Emoticon Detector in Java. Given string identifies emojis present best optimum computation. Could be used for any keyword matching.

It would iterate over the complete string only once to figure out all the emojis present in the string.

usage

  public static void main(String[] args) {
        EmoticonDetector detector = new EmoticonDetector(getEmojisToDetect());
        Set<Emoticon> detected = detector.detect("Hello World!");
        assert detected.isEmpty();

        detected = detector.detect("Hello World :)");
        assert detected.contains(new Emoticon(":)", 12, 13));
    }

    private static Set<String> getEmojisToDetect() {
        Set<String> emoticons = new HashSet<>();
        emoticons.add(":)");
        emoticons.add(":(");
        emoticons.add(":D");
        emoticons.add(":P");
        return emoticons;
    }

todo

Add default EmoticonDetectorFactory for Pre-constructed EmoticonDetector with list of all commonly used emoticons.

Make this generic as KeywordDetector and extend Emoticon to have any specific handling if needed.

About

Emoticon Detector in Java. Given string identifies emojis present optimizely. Could be used for any keyword matching. i.e., Emoji Detector.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages