Examples of Morphology


Examples of edu.stanford.nlp.process.Morphology

        // choose rarer scales for neutral tweets
        return Chance.test(50) ? Scale.LYDIAN : Scale.DORIAN;
    }

    private Variation getVariation(List<Tweet> tweets, TimelineMusic meta) {
        Morphology morphology = new Morphology(new StringReader(""));
        Multiset<String> words = HashMultiset.create();
        for (Tweet tweet : tweets) {
            String tweetText = tweet.getText().toLowerCase();
            List<String> urls = TimelineToMusicService.extractUrls(tweetText);
            for (String url : urls) {
                tweetText = tweetText.replace(url, "");
            }
            List<String> usernames = TimelineToMusicService.extractMentionedUsernames(tweetText);
            for (String username : usernames) {
                tweetText = tweetText.replace(username, "").replace("rt", "");
            }

            String[] wordsInTweet = tweetText.split("[^\\p{L}&&[^']]+");
            for (String word : wordsInTweet) {
                try {
                    words.add(morphology.stem(word));
                } catch (Exception ex) {
                    words.add(word);
                }
            }
        }
View Full Code Here

Examples of edu.stanford.nlp.process.Morphology

public class WordStemmer implements TreeVisitor {

  private Morphology morpha;

  public WordStemmer() {
    morpha = new Morphology();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.