Esempio n. 1
0
        private void setWordsAndEmoticons()
        {
            setWordsOnly();

            ArrayList wordsAndEmoticonsList = VaderLuceneAnalyzer.defaultSplit(inputText);

            foreach (var currentWord in wordsOnly)
            {
                foreach (var currentPunc in Utils.PUNCTUATION_LIST)
                {
                    String         pWord = currentWord.ToString() + currentPunc.ToString();
                    IList <string> words = new List <string> {
                    };
                    foreach (var wordAndEmoticon in wordsAndEmoticonsList)
                    {
                        words.Add(wordAndEmoticon.ToString());
                    }

                    int pWordCount = words.Where(x => x.Equals(pWord)).Count();

                    while (pWordCount > 0)
                    {
                        int index = wordsAndEmoticonsList.IndexOf(pWord);
                        wordsAndEmoticonsList.Remove(pWord);
                        wordsAndEmoticonsList.Insert(index, currentWord);

                        words = new List <string> {
                        };
                        foreach (var wordAndEmoticon in wordsAndEmoticonsList)
                        {
                            words.Add(wordAndEmoticon.ToString());
                        }

                        pWordCount = words.Where(x => x.Equals(pWord)).Count();
                    }

                    String wordP = currentPunc.ToString() + currentWord.ToString();
                    words = new List <string> {
                    };
                    foreach (var wordAndEmoticon in wordsAndEmoticonsList)
                    {
                        words.Add(wordAndEmoticon.ToString());
                    }
                    int wordPCount = words.Where(x => x.Equals(wordP)).Count();

                    while (wordPCount > 0)
                    {
                        int index = wordsAndEmoticonsList.IndexOf(wordP);
                        wordsAndEmoticonsList.Remove(wordP);
                        wordsAndEmoticonsList.Insert(index, currentWord);

                        words = new List <string> {
                        };
                        foreach (var wordAndEmoticon in wordsAndEmoticonsList)
                        {
                            words.Add(wordAndEmoticon.ToString());
                        }

                        wordPCount = words.Where(x => x.Equals(wordP)).Count();
                    }
                }
            }

            this.wordsAndEmoticons = wordsAndEmoticonsList;
        }
Esempio n. 2
0
 private void setWordsOnly()
 {
     this.wordsOnly = VaderLuceneAnalyzer.removePunctuation(inputText);
 }