private String tableNameByPos(PartOfSpeech pos) { String ret = null; if (simplerPos(pos.getCanonicalPosTag())==SimplerCanonicalPosTag.VERB) ret = "verbs_200"; else if (simplerPos(pos.getCanonicalPosTag())==SimplerCanonicalPosTag.NOUN) ret = "nouns_200"; return ret; }
protected static char toChar(PartOfSpeech pos) { switch (simplerPos(pos.getCanonicalPosTag())) { case NOUN: return 'n'; case VERB: return 'v'; case ADJECTIVE: return 'a'; //case ADVERB: return 'r'; case PREPOSITION: return 'p'; //case DETERMINER: return 'd'; case PRONOUN: return 'n'; // NOTE: in UNARY_BINC database, a pronoun is considered a 'n' - not 'p'! //case PUNCTUATION: return ','; default: return '0'; // no pos tag } }
@Override public boolean evaluate(T object) { PartOfSpeech pos = InfoGetFields.getPartOfSpeechObject(object); return ( simplerPos(pos.getCanonicalPosTag())==SimplerCanonicalPosTag.VERB || simplerPos(pos.getCanonicalPosTag())==SimplerCanonicalPosTag.ADJECTIVE || simplerPos(pos.getCanonicalPosTag())==SimplerCanonicalPosTag.NOUN || simplerPos(pos.getCanonicalPosTag())==SimplerCanonicalPosTag.PRONOUN ); } }
@Override public List<LexicalRule<? extends VerbOceanRuleInfo>> getRulesForLeft(String lemma, PartOfSpeech pos) throws LexicalResourceException { if (lemma == null) throw new LexicalResourceException("lemma is null"); List<LexicalRule<? extends VerbOceanRuleInfo>> rules = new Vector<LexicalRule<? extends VerbOceanRuleInfo>>(); if((pos==null || simplerPos(pos.getCanonicalPosTag()) == SimplerCanonicalPosTag.VERB) && mapRulesByEntailingVerb.containsKey(lemma)){ rules.addAll(mapRulesByEntailingVerb.get(lemma)); } return new ArrayList<LexicalRule<? extends VerbOceanRuleInfo>>(rules); }
@Override public List<LexicalRule<? extends VerbOceanRuleInfo>> getRulesForRight(String lemma, PartOfSpeech pos) throws LexicalResourceException { if (lemma == null) throw new LexicalResourceException("lemma is null"); List<LexicalRule<? extends VerbOceanRuleInfo>> rules = new Vector<LexicalRule<? extends VerbOceanRuleInfo>>(); if((pos==null || simplerPos(pos.getCanonicalPosTag()) == SimplerCanonicalPosTag.VERB) && mapRulesByEntailedVerb.containsKey(lemma)){ rules.addAll(mapRulesByEntailedVerb.get(lemma)); } return new ArrayList<LexicalRule<? extends VerbOceanRuleInfo>>(rules); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((simplerPos(pos.getCanonicalPosTag()) == null) ? 0 : simplerPos(pos.getCanonicalPosTag()).hashCode()); result = prime * result + ((word == null) ? 0 : word.hashCode()); return result; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((lemma == null) ? 0 : lemma.hashCode()); result = prime * result + ((simplerPos(pos.getCanonicalPosTag()) == null) ? 0 : simplerPos(pos.getCanonicalPosTag()).hashCode()); return result; }
/** * @param lPos * @return */ protected Set<PreparedStatementAndPos> posToScoreStmt(PartOfSpeech pos) { if (pos == null) return ALL_SCORES_STMTS; switch (simplerPos(pos.getCanonicalPosTag())) { case NOUN: return NOUN_SCORE_STMT_SET; case VERB: return VERB_SCORE_STMT_SET; default: break; } return EMPTY_SET; }
@Override public boolean evaluate(T object) { PartOfSpeech pos = InfoGetFields.getPartOfSpeechObject(object); return ( simplerPos(pos.getCanonicalPosTag())==SimplerCanonicalPosTag.ADJECTIVE || simplerPos(pos.getCanonicalPosTag())==SimplerCanonicalPosTag.ADVERB || simplerPos(pos.getCanonicalPosTag())==SimplerCanonicalPosTag.NOUN || simplerPos(pos.getCanonicalPosTag())==SimplerCanonicalPosTag.PRONOUN || "VBN".equals(pos.getStringRepresentation()) // a passive noun is also considered an adjective! ); } }
/** * @param partOfSpeechObject * @param partOfSpeechObject2 * @return */ private boolean posMatch(PartOfSpeech textPartOfSpeech, PartOfSpeech rulePartOfSpeech) { return (WildcardPartOfSpeech.isWildCardPOS(rulePartOfSpeech) || simplerPos(textPartOfSpeech.getCanonicalPosTag())==simplerPos(rulePartOfSpeech.getCanonicalPosTag()) ); }
@Override public boolean evaluate(T object) { PartOfSpeech pos = InfoGetFields.getPartOfSpeechObject(object); return ( simplerPos(pos.getCanonicalPosTag())==SimplerCanonicalPosTag.NOUN || simplerPos(pos.getCanonicalPosTag())==SimplerCanonicalPosTag.PRONOUN ); } }
public static final boolean posEqual(PartOfSpeech textPos, PartOfSpeech hypothesisPos) { if (textPos==hypothesisPos)return true; SimplerCanonicalPosTag canonicalText = (null==textPos)?SimplerCanonicalPosTag.OTHER:simplerPos(textPos.getCanonicalPosTag()); SimplerCanonicalPosTag canonicalhypothesis = (null==hypothesisPos)?SimplerCanonicalPosTag.OTHER:simplerPos(hypothesisPos.getCanonicalPosTag()); if (canonicalText.equals(canonicalhypothesis)) return true; else return false; }
/** * @param partOfSpeechObject * @param partOfSpeechObject2 * @return */ private boolean posMatch(PartOfSpeech textPartOfSpeech, PartOfSpeech rulePartOfSpeech) { return (WildcardPartOfSpeech.isWildCardPOS(rulePartOfSpeech) || simplerPos(textPartOfSpeech.getCanonicalPosTag())==simplerPos(rulePartOfSpeech.getCanonicalPosTag()) ); }
/** * @param partOfSpeechObject * @param partOfSpeechObject2 * @return */ private boolean posMatch(PartOfSpeech textPartOfSpeech, PartOfSpeech rulePartOfSpeech) { return (WildcardPartOfSpeech.isWildCardPOS(rulePartOfSpeech) || simplerPos(textPartOfSpeech.getCanonicalPosTag())==simplerPos(rulePartOfSpeech.getCanonicalPosTag()) ); }
@Override public boolean evaluate(T object) { PartOfSpeech pos = InfoGetFields.getPartOfSpeechObject(object); return ( simplerPos(pos.getCanonicalPosTag())==SimplerCanonicalPosTag.VERB ); } }
private boolean isContent(ExtendedNode node) { return contentPoses.contains( SimplerPosTagConvertor.simplerPos( InfoGetFields.getPartOfSpeechObject(node.getInfo()).getCanonicalPosTag())); }
/** * @param partOfSpeech * @return */ private boolean isUnspecifiedPos(PartOfSpeech partOfSpeech) { return simplerPos(partOfSpeech.getCanonicalPosTag()).toString().equals(partOfSpeech.getStringRepresentation()); }
@Override public List<LexicalRule<? extends VerbOceanRuleInfo>> getRules(String leftLemma, PartOfSpeech leftPos, String rightLemma, PartOfSpeech rightPos) throws LexicalResourceException { if (leftLemma == null) throw new LexicalResourceException("left lemma is null"); if (rightLemma == null) throw new LexicalResourceException("right lemma is null"); List<LexicalRule<? extends VerbOceanRuleInfo>> rules = new ArrayList<LexicalRule<? extends VerbOceanRuleInfo>>(); if((leftPos==null || simplerPos(leftPos.getCanonicalPosTag()) == SimplerCanonicalPosTag.VERB) && (rightPos==null || simplerPos(rightPos.getCanonicalPosTag()) == SimplerCanonicalPosTag.VERB)){ LexicalRule<? extends VerbOceanRuleInfo> rule = mapRulesByEntailmentPair.get(new EntailmentPair(leftLemma, rightLemma)); if(rule != null){ rules.add(rule); } } return rules; }
private boolean posIsContent(S node) { SimplerCanonicalPosTag pos = SimplerPosTagConvertor.simplerPos(InfoGetFields.getCanonicalPartOfSpeech(node.getInfo())); switch(pos) { case NOUN: return true; case VERB: return true; case ADJECTIVE: return true; case ADVERB: return true; default: return false; } }
private boolean isContentNode(S node) { boolean ret = false; SimplerCanonicalPosTag pos = SimplerPosTagConvertor.simplerPos(InfoGetFields.getCanonicalPartOfSpeech(node.getInfo())); switch (pos) { case NOUN: case VERB: case ADJECTIVE: case ADVERB: ret=true; break; default: ret = false; break; } return ret; }