コード例 #1
0
ファイル: pronouns.py プロジェクト: josubg/CorefGraph
     "everybody", "everyone", "everything", "less", "little", "much",
     "neither", "no one", "nobody", "nothing", "one", "other", "plenty",
     "somebody", "someone", "something", "both", "few", "fewer", "many",
     "others", "several", "all", "any", "more", "most", "none", "some",
     "such"))

relative = list_checker(("that", "who", "which", "whom", "where", "whose"))
reflexive = list_checker(
    ("myself", "yourself", "yourselves", "himself", "herself", "itself",
     "ourselves", "themselves", "oneself"))

no_organization = list_checker(
    ("i", "me", "myself", "mine", "my", "yourself", "he", "him", "himself",
     "his", "she", "her", "herself", "hers", "here"))

first_person = list_checker(("i", "me", "myself", "mine", "my", "we", "us",
                             "ourself", "ourselves", "ours", "our"))
second_person = list_checker(
    ("you", "yourself", "yours", "your", "yourselves"))
third_person = list_checker(
    ("he", "him", "himself", "his", "she", "her", "herself", "hers", "her",
     "it", "itself", "its", "one", "oneself", "one's", "they", "them",
     "themself", "themselves", "theirs", "their", "they", "them", "'em",
     "themselves"))
_others = list_checker(("who", "whom", "whose", "where", "when", "which"))

all = lambda x: first_person(x) or second_person(x) or third_person(
    x) or _others(x)

pleonastic = equality_checker("it")
コード例 #2
0
# coding=utf-8

from corefgraph.resources.lambdas import list_checker, equality_checker, matcher, fail

__author__ = 'Josu Bermudez <*****@*****.**>'

# Is a root constituent
root = list_checker(("root", "top", "ROOT", "TOP"))

# Is a clause
clause = matcher("^S")

# Is a Noun phrase
noun_phrase = equality_checker("NP")

# Is a Noun phrase
#prepositional_phrase = equality_checker("SP")

# Is a Verb phrase
verb_phrase = equality_checker("VP")

# Is a particle constituent
particle_constituent = equality_checker("PRT")

# Is an interjection constituent
past_participle_verb = equality_checker("VBN")

# Is an interjection constituent
interjection = equality_checker("INTJ")

# Is a simple or subordinated clause
コード例 #3
0
__author__ = 'Valeria Quochi <*****@*****.**>'

# Is a root constituent
root = list_checker(("root", "top", "ROOT", "TOP"))

# Is a clause
clause = list_checker((
    "S",
    "SBAR",
))

# Is a simple or subordinated clause
simple_or_sub_phrase = clause

# Is a Noun phrase
noun_phrase = equality_checker("NP")

# Is a Verb phrase
verb_phrase = equality_checker("VP")

# Is a Adverbial phrase
adverbial_phrase = fail()

# Is a complement direct
complement_direct = list_checker(("CD", ))

# Is a particle constituent
particle_constituent = fail()

# Is a past_participle verb constituent
past_participle_verb = equality_checker("VBN")
コード例 #4
0
# coding=utf-8
"""

"""

__author__ = 'Josu Bermudez <*****@*****.**>'
__date__ = '3/13' # DD/MM/YY

from corefgraph.resources.lambdas import list_checker, equality_checker, matcher, fail

# Extracted from CoreNLP

indefinite_articles = list_checker(("a", "an"))

quantifiers = list_checker(("not", "every", "any", "none", "everything", "anything", "nothing", "all", "enough"))

partitives = list_checker((
    "half", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten",
    "hundred", "thousand", "million", "billion", "tens", "dozens", "hundreds", "thousands", "millions", "billions",
    "group", "groups", "bunch", "number", "numbers", "pinch", "amount", "amount", "total", "all", "mile",
    "miles", "pounds"))

partitive_particle = equality_checker("of")
コード例 #5
0
ファイル: partofspeech.py プロジェクト: josubg/CorefGraph
pronoun = matcher("^PRON.*")
personal_pronoun = matcher("^PRON.*PRS.*")
relative_pronoun = matcher("^PRON.*REL.*")
interrogative_pronoun = matcher("^PRON.*INT.*")
mention_pronoun = lambda x: relative_pronoun(x) or personal_pronoun(x)

# Nouns
singular_common_noun = matcher("^NOUN.*SING.*")
plural_common_noun = matcher("^NOUN.*PLUR.*")
common_noun = matcher("^NOUN.*")
proper_noun = matcher("^PROPN.*")
noun = matcher("^PROPN|^NOUN")

# Verbs
verb = matcher("^VERB")
modal = equality_checker("^AUX")
mod_forms = lambda x: common_noun(x) or adjective(x) or verb(x) or cardinal(x)
indefinites = fail()

# Enumerations
enumerable_mention_words = noun

conjunction = equality_checker("CONJ")
interjection = equality_checker("INTERJ")
cardinal = equality_checker("CD")

# Determinant
determinant = lambda x: not verb(x) and matcher("DET")
indefinite = lambda x: not verb(x) and matcher("IND")

head_rules = noun
コード例 #6
0
ファイル: partofspeech.py プロジェクト: josubg/CorefGraph
# coding=utf-8
from corefgraph.resources.lambdas import equality_checker, fail, matcher

__author__ = 'Valeria Quochi <*****@*****.**>'
__date__ = '5/16/2013'

# features questions
female = fail()
male = fail()
neutral = fail()
singular = equality_checker("^NOU_CS")
plural = equality_checker("^NOU_CP")
animate = fail()
inanimate = fail()

# Adjectives
adjective = matcher("^ADJ.*")

# pronouns
personal_pronoun = matcher("^PRO~PE")
relative_pronoun = matcher("^PRO~RE")
pronoun = matcher("^PRO")
mention_pronoun = lambda x: relative_pronoun(x) or personal_pronoun(x)

singular_common_noun = equality_checker("^NOU_CS")
plural_common_noun = equality_checker("^NOU_CP")
proper_noun = matcher("^NOU~PR")
noun = matcher("^NOU.*")

verbs = matcher("^V.*")
modals = equality_checker("^VMO.*")
コード例 #7
0
ファイル: constituent.py プロジェクト: josubg/CorefGraph
# Is a clause
clause = list_checker(("S", "SENTENCE"))

# Is a Noun phrase
noun_phrase = list_checker(("SN", "GRUP.NOM", "SUJ"))

# Is a Verb phrase
verb_phrase = list_checker(("GRUP.VERB",))

# Is a complement direct
complement_direct = list_checker(("CD",))

# Is a particle constituent
particle_constituent = fail()

# Is a past_participle verb constituent
past_participle_verb = fail()

# Is an interjection constituent
interjection = equality_checker("INTERJECCIÓ")

# Is a NER annotated into semantic tree
ner_constituent = fail()

# Is a simple or subordinated clause
simple_or_sub_phrase = clause

#TODO Remove this check
mention_constituents = lambda x: noun_phrase(x) or complement_direct(x)

enumerable = list_checker(("^SN", "GRUP.NOM"))
コード例 #8
0
ファイル: verbs.py プロジェクト: josubg/CorefGraph
    "emfatitzar",
    "suggerir",
    "recolsar",
    "suposar",
    "conjecturar",
    "sospitar",
    "jurar",
    "ensenyar",
    "dir",
    "testificar",
    "pensar",
    "amenaçar",
    "descobrir",
    "subratllar",
    "destacar",
    "emfatitzar",
    "urguir",
    "expressar",
    "jurar",
    "prometre",
    "avisa",
    "saludar",
    "desitjar",
    "qüestionar",
    "preocupar",
    "escriure"))

generics_you_verbs = equality_checker("saps")

pleonastic_verbs = list_checker(("ser", "estar", "semblar", "explicar"))
コード例 #9
0
     "determine", "disagree", "disclose", "discount", "discover", "discuss",
     "dismiss", "dispute", "disregard", "doubt", "emphasize", "encourage",
     "endorse", "equate", "estimate", "expect", "explain", "express", "extoll",
     "fear", "feel", "find", "forbid", "forecast", "foretell", "forget",
     "gather", "guarantee", "guess", "hear", "hint", "hope", "illustrate",
     "imagine", "imply", "indicate", "inform", "insert", "insist", "instruct",
     "interpret", "interview", "invite", "issue", "justify", "learn",
     "maintain", "mean", "mention", "negotiate", "note", "observe", "offer",
     "oppose", "order", "persuade", "pledge", "point", "point out", "praise",
     "pray", "predict", "prefer", "present", "promise", "prompt", "propose",
     "protest", "prove", "provoke", "question", "quote", "raise", "rally",
     "read", "reaffirm", "realise", "realize", "rebut", "recall", "reckon",
     "recommend", "refer", "reflect", "refuse", "refute", "reiterate",
     "reject", "relate", "remark", "remember", "remind", "repeat", "reply",
     "add_report", "request", "respond", "restate", "reveal", "rule", "say",
     "see", "show", "signal", "sing", "slam", "speculate", "spoke", "spread",
     "state", "stipulate", "stress", "suggest", "support", "suppose",
     "surmise", "suspect", "swear", "teach", "tell", "testify", "think",
     "threaten", "told", "uncover", "underline", "underscore", "urge", "voice",
     "vow", "warn", "welcome", "wish", "wonder", "worry", "write"))

generics_you_verbs = equality_checker("know")

pleonastic_verbs = list_checker(("is", "was", "became", "become"))
pleonastic_verbs_full = list_checker(
    ("is", "was", "be", "becomes", "become", "became"))
alternative_a_pleonastic_verbs = list_checker(
    ("seems", "appears", "means", "follows"))
alternative_b_pleonastic_verbs = equality_checker("turns")
alternative_c_pleonastic_verbs = list_checker(("be", "become"))
コード例 #10
0
ファイル: partofspeech_old.py プロジェクト: josubg/CorefGraph
ADJ~IR : interrogative adjective
ADJ~EX : exclamative adjective

following lines modified accordingly
TODO check correctedness
adjective_qualif = "ADJ~QU"
adjective_ord = "ADJ~OR"
adjective_indef = "ADJ~IN"
adjective_dem = "ADJ~DE"
adjective_poss = "ADJ~PO"
adjective_deitt = "ADJ~DI"
adjective_interr = "ADJ~IR"
adjective_excl = "ADJ~EX"
"""

_conjunctions = equality_checker("CONJ", )

# Usable functions

# features questions
female = fail()
male = fail()
neutral = fail()
singular = fail()
plural = fail()
animate = fail()
inanimate = fail()

# Adjectives
adjective = list_checker(
    (_adjective, _adjective_comparative, _adjective_superlative))
コード例 #11
0
ファイル: constituent.py プロジェクト: josubg/CorefGraph
__author__ = 'Josu Bermudez <*****@*****.**>'

# Is a root constituent
root = list_checker(("root", "top", "ROOT", "TOP"))

# Is a clause
clause = list_checker(("S", "SENTENCE"))

# Is a simple or subordinated clause
simple_or_sub_phrase = clause

# Is a Noun phrase
noun_phrase = list_checker(("SN", "SUJ", "GRUP.NOM"))

# Is a Verb phrase
verb_phrase = equality_checker("GRUP.VERB")

# Is a Adverbial phrase
adverbial_phrase = equality_checker("SADV")

# Is a complement direct
complement_direct = equality_checker("CD")

# Is a particle constituent
particle_constituent = fail()

# Is a past_participle verb constituent
past_participle_verb = fail()

# Is an interjection constituent
interjection = equality_checker("INTERJECCIÓ")
コード例 #12
0
plural = matcher("^NNP?S$")

animate = fail()
inanimate = fail()

# Adjectives
adjective = list_checker((_adjective, ))

# Pronouns
pronoun = list_checker((_personal_pronoun, _possessive_pronoun, _wh_pronoun,
                        _wh_possessive_pronoun))
relative_pronoun = list_checker((_wh_pronoun, _wh_possessive_pronoun))
mention_pronoun = matcher("^PRP")

# Nouns
singular_common_noun = equality_checker(_noun)
plural_common_noun = equality_checker(_noun_plural)
proper_noun = list_checker((_proper_noun, _proper_noun_plural))
noun = lambda x: x is not None and (singular_common_noun(x) or
                                    plural_common_noun(x) or proper_noun(x))

# Verbs
verb = list_checker(_verbs_list)
modal = equality_checker(_modal)

mod_forms = lambda x: x is not None and (x.startswith("N") or x.startswith(
    "JJ") or x.startswith("V") or x == "CD")
indefinite = fail

# Enumerations
enumerable_mention_words = matcher("^NNP")