/// <summary> Constructor.</summary> /// <param name="tagger">- the POS tagger plug-in /// </param> /// <param name="in">- input queue /// </param> /// <param name="out">- output queue /// </param> public PosTaggerThread(PosTagger tagger, LinkedBlockingQueue <SetOfSentences> in_Renamed, LinkedBlockingQueue <Sentence> out_Renamed) { this.tagger = tagger; this.in_Renamed = in_Renamed; this.out_Renamed = out_Renamed; }
/// <summary> Constructor.</summary> /// <param name="tagger">- the POS tagger plug-in /// </param> /// <param name="in">- input queue /// </param> /// <param name="out">- output queue /// </param> public PosTaggerThread(PosTagger tagger, LinkedBlockingQueue<SetOfSentences> in_Renamed, LinkedBlockingQueue<Sentence> out_Renamed) { this.tagger = tagger; this.in_Renamed = in_Renamed; this.out_Renamed = out_Renamed; }
///////////////////////////////////////////////////////////////////////////////////// public HomeController(IOptions <TwitterCrawlerConfig> config) { posTagger = new PosTagger(); twitterCrawler = new TwitterCrawler(config); tokenizer = new Tokenizer(); tokenAnalyser = new TokenAnalyser(); tweetAnalyser = new TweetAnalyser(); wordRater = new WordRater(); sentimentCalculator = new SentimentCalculator(); preprocessor = new Preprocessor(); parseTreeAnalyser = new ParseTreeAnalyser(); networkSendClientSocket = new NetworkClientSocket(NetworkSendClientPort, NetworkClientHost); networkReceiveClientSocket = new NetworkClientSocket(NetworkReceiveClientPort, NetworkClientHost); serializer = new Serializer(); deserializer = new Deserializer(); tester = new Tester(); }
/// <summary> /// Assigns part-of-speech tags to the words in the given MethodDeclarationNode's name, assuming that it follows a base verb pattern. /// This assumes that the node has already had its name split and preamble stripped. /// </summary> /// <param name="node">The MethodDeclarationNode to tag.</param> protected void ParseBaseVerbName(MethodDeclarationNode node) { //this assumes that the node has already had its name split and preamble stripped PhraseNode parsedName = node.ParsedName; //TODO: from Emily, what if it starts with an adverb?? //if 1 word, assume verb if (parsedName.Size() == 1) { if (PosData.IsIgnorableVerb(parsedName[0].Text)) { parsedName[0].Tag = PartOfSpeechTag.VerbIgnorable; } else { parsedName[0].Tag = PartOfSpeechTag.Verb; } return; } int currentWord = 0; currentWord = CheckForIgnorableVerb(parsedName, currentWord); //check for a verb modifier if (currentWord < parsedName.Size()) { if (PosData.IsAdverb(parsedName[currentWord].Text) && parsedName[currentWord].Text.EndsWith("ly") && !PosData.IsDeterminer(parsedName[currentWord].Text) && !PosData.IsPronoun(parsedName[currentWord].Text) && !PosData.IsPreposition(parsedName[currentWord].Text)) { if (currentWord + 1 < parsedName.Size() && PosData.IsPotentialVerb(parsedName[currentWord + 1].Text)) { parsedName[currentWord].Tag = PartOfSpeechTag.VerbModifier; } } } if (PosData.IsIgnorableVerb(parsedName[currentWord].Text)) { parsedName[currentWord].Tag = PartOfSpeechTag.VerbIgnorable; } else { parsedName[currentWord].Tag = PartOfSpeechTag.Verb; } currentWord++; //check for verb particle if (currentWord < parsedName.Size()) { if (PosData.IsVerbParticle(parsedName[currentWord - 1].Text, parsedName[currentWord].Text)) { parsedName[currentWord].Tag = PartOfSpeechTag.VerbParticle; } } //rest of words should be objects or prepositions if (currentWord < parsedName.Size()) { int prep = FindFirstPreposition(parsedName, currentWord); if (prep == -1) { PosTagger.TagNounPhrase(parsedName, currentWord, parsedName.Size() - 1); } else { //found a preposition, could be VX?PY?(f?) bool noX = false; bool noY = false; if (currentWord == prep) { noX = true; } else { PosTagger.TagNounPhrase(parsedName, currentWord, prep - 1); } currentWord = prep + 1; if (currentWord >= parsedName.Size()) { noY = true; } else { PosTagger.TagNounPhrase(parsedName, currentWord, parsedName.Size() - 1); } } } }