You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 KiB
48 KiB
In [2]:
from pattern.search import STRICT, search from pattern.en import parsetree
https://github.com/clips/pattern/wiki/pattern-search ( inspired by videogrep search )
In [3]:
text = open("RESURGENCE.txt").read()
In [4]:
text[:100]
Out[4]:
'RESURGENCE | Isabelle Stengers \n\n“We are the grandchildren of the witches you were not able to burn”'
In [5]:
tree = parsetree(text)
In [80]:
n = 0 actions = [] for s in tree: f = open(f"page{n}.html","w") print("""<meta charset='utf-8'><link type="text/css" rel="stylesheet" href="body.css">""","here is your fate:",file = f) print(s, file = f) print(actions[1],file = f) f.close() n = n + 1
In [81]:
tree[7]
Out[81]:
Sentence("I/PRP/B-NP/O will/MD/B-VP/O honour/NN/B-NP/O the/DT/I-NP/O vision/NN/I-NP/O which/WDT/O/O ,/,/O/O since/IN/B-PP/B-PNP the/DT/B-NP/I-PNP Reagan/NNP/I-NP/I-PNP era/NN/I-NP/I-PNP ,/,/O/O has/VBZ/B-VP/O sustained/VBN/I-VP/O reclaiming/VBG/I-VP/O witches/NNS/B-NP/O such/JJ/B-ADJP/O as/IN/B-PP/B-PNP Starhawk/NNP/B-NP/I-PNP ,/,/O/O who/WP/O/O associate/VBP/B-VP/O their/PRP$/B-NP/O activism/NN/I-NP/O with/IN/B-PP/B-PNP the/DT/B-NP/I-PNP memory/NN/I-NP/I-PNP of/IN/B-PP/B-PNP a/DT/B-NP/I-PNP past/NN/I-NP/I-PNP earth-based/JJ/B-NP/I-PNP religion/NN/I-NP/I-PNP of/IN/B-PP/B-PNP the/DT/B-NP/I-PNP goddess/NN/I-NP/I-PNP -/:/O/O who/WP/O/O now/RB/B-ADVP/O ‘/''/O/O returns/NNS/B-NP/O ././O/O")
In [82]:
search("JJ", tree)
Out[82]:
[Match(words=[Word('able/JJ')]), Match(words=[Word('recent/JJ')]), Match(words=[Word('defiant/JJ')]), Match(words=[Word('past/JJ')]), Match(words=[Word('dead/JJ')]), Match(words=[Word('many/JJ')]), Match(words=[Word('imaginary/JJ')]), Match(words=[Word('collective/JJ')]), Match(words=[Word('different/JJ')]), Match(words=[Word('burning/JJ')]), Match(words=[Word('rural/JJ')]), Match(words=[Word('old/JJ')]), Match(words=[Word('violent/JJ')]), Match(words=[Word('unquestionable/JJ')]), Match(words=[Word('modern/JJ')]), Match(words=[Word('defiant/JJ')]), Match(words=[Word('past/JJ')]), Match(words=[Word('such/JJ')]), Match(words=[Word('earth-based/JJ')]), Match(words=[Word('ongoing/JJ')]), Match(words=[Word('academic/JJ')]), Match(words=[Word('critical/JJ')]), Match(words=[Word('academic/JJ')]), Match(words=[Word('futile/JJ')]), Match(words=[Word('few/JJ')]), Match(words=[Word('regressive/JJ')]), Match(words=[Word('busy/JJ')]), Match(words=[Word('relentless/JJ')]), Match(words=[Word('neoliberal/JJ')]), Match(words=[Word('past/JJ')]), Match(words=[Word('eradicative/JJ')]), Match(words=[Word('futile/JJ')]), Match(words=[Word('Creative/JJ')]), Match(words=[Word('interconnecting/JJ')]), Match(words=[Word('such/JJ')]), Match(words=[Word('academic/JJ')]), Match(words=[Word('own/JJ')]), Match(words=[Word('specific/JJ')]), Match(words=[Word('deleterious/JJ')]), Match(words=[Word('agricultural/JJ')]), Match(words=[Word('successful/JJ')]), Match(words=[Word('natural/JJ')]), Match(words=[Word('industrial/JJ')]), Match(words=[Word('such/JJ')]), Match(words=[Word('stable/JJ')]), Match(words=[Word('natural/JJ')]), Match(words=[Word('ordered/JJ')]), Match(words=[Word('scientific/JJ')]), Match(words=[Word('academic/JJ')]), Match(words=[Word('past/JJ')]), Match(words=[Word('critical/JJ')]), Match(words=[Word('feminist/JJ')]), Match(words=[Word('sexist/JJ')]), Match(words=[Word('rational/JJ')]), Match(words=[Word('contemporary/JJ')]), Match(words=[Word('eradicative/JJ')]), Match(words=[Word('possible/JJ')]), Match(words=[Word('oppressive/JJ')]), Match(words=[Word('religious/JJ')]), Match(words=[Word('possible/JJ')]), Match(words=[Word('past/JJ')]), Match(words=[Word('new/JJ')]), Match(words=[Word('academic/JJ')]), Match(words=[Word('only/JJ')]), Match(words=[Word('true/JJ')]), Match(words=[Word('objective/JJ')]), Match(words=[Word('past/JJ')]), Match(words=[Word('rid/JJ')]), Match(words=[Word('academic/JJ')]), Match(words=[Word('eradicative/JJ')]), Match(words=[Word('human/JJ')]), Match(words=[Word('give/JJ')]), Match(words=[Word('subjective/JJ')]), Match(words=[Word('objective/JJ')]), Match(words=[Word('relevant/JJ')]), Match(words=[Word('mobilized/JJ')]), Match(words=[Word('complex/JJ')]), Match(words=[Word('unattended/JJ')]), Match(words=[Word('easy/JJ')]), Match(words=[Word('strict/JJ')]), Match(words=[Word('experimental/JJ')]), Match(words=[Word('exceptional/JJ')]), Match(words=[Word('fragile/JJ')]), Match(words=[Word('experimental/JJ')]), Match(words=[Word('active/JJ')]), Match(words=[Word('unusual/JJ')]), Match(words=[Word('other/JJ')]), Match(words=[Word('possible/JJ')]), Match(words=[Word('Experimental/JJ')]), Match(words=[Word('fragile/JJ')]), Match(words=[Word('experimental/JJ')]), Match(words=[Word('experimental/JJ')]), Match(words=[Word('become/JJ')]), Match(words=[Word('messy/JJ')]), Match(words=[Word('real/JJ')]), Match(words=[Word('devastating/JJ')]), Match(words=[Word('unilateral/JJ')]), Match(words=[Word('mere/JJ')]), Match(words=[Word('other/JJ')]), Match(words=[Word('muted/JJ')]), Match(words=[Word('good/JJ')]), Match(words=[Word('relevant/JJ')]), Match(words=[Word('bad/JJ')]), Match(words=[Word('abusive/JJ')]), Match(words=[Word('critical/JJ')]), Match(words=[Word('such/JJ')]), Match(words=[Word('ludicrous/JJ')]), Match(words=[Word('such/JJ')]), Match(words=[Word('theoretical/JJ')]), Match(words=[Word('scientific/JJ')]), Match(words=[Word('famous/JJ')]), Match(words=[Word('cooperative/JJ')]), Match(words=[Word('collaborative/JJ')]), Match(words=[Word('such/JJ')]), Match(words=[Word('creative/JJ')]), Match(words=[Word('common/JJ')]), Match(words=[Word('sad/JJ')]), Match(words=[Word('academic/JJ')]), Match(words=[Word('concerned/JJ')]), Match(words=[Word('common/JJ')]), Match(words=[Word('cooperative/JJ')]), Match(words=[Word('non-antagonist/JJ')]), Match(words=[Word('concerned/JJ')]), Match(words=[Word('laborious/JJ')]), Match(words=[Word('hesitant/JJ')]), Match(words=[Word('conflictual/JJ')]), Match(words=[Word('collective/JJ')]), Match(words=[Word('particular/JJ')]), Match(words=[Word('practical/JJ')]), Match(words=[Word('eradicative/JJ')]), Match(words=[Word('give/JJ')]), Match(words=[Word('collective/JJ')]), Match(words=[Word('many/JJ')]), Match(words=[Word('academic/JJ')]), Match(words=[Word('PowerPoint/JJ')]), Match(words=[Word('authoritative/JJ')]), Match(words=[Word('confrontational/JJ')]), Match(words=[Word('ancient/JJ')]), Match(words=[Word('academic/JJ')]), Match(words=[Word('traditional/JJ')]), Match(words=[Word('many/JJ')]), Match(words=[Word('activist/JJ')]), Match(words=[Word('contemporary/JJ')]), Match(words=[Word('common/JJ')]), Match(words=[Word('design/JJ')]), Match(words=[Word('resurgent/JJ')]), Match(words=[Word('deliberative/JJ')]), Match(words=[Word('appropriate/JJ')]), Match(words=[Word('own/JJ')]), Match(words=[Word('such/JJ')]), Match(words=[Word('shared/JJ')]), Match(words=[Word('free/JJ')]), Match(words=[Word('participatory/JJ')]), Match(words=[Word('own/JJ')]), Match(words=[Word('other/JJ')]), Match(words=[Word('s/JJ')]), Match(words=[Word('transformative/JJ')]), Match(words=[Word('slow/JJ')]), Match(words=[Word('mutual/JJ')]), Match(words=[Word('mutual/JJ')]), Match(words=[Word('own/JJ')]), Match(words=[Word('b]Polyphonic/JJ')]), Match(words=[Word('relevant/JJ')]), Match(words=[Word('authoritative/JJ')]), Match(words=[Word('biotechnological/JJ')]), Match(words=[Word('self-contained/JJ')]), Match(words=[Word('isolable/JJ')]), Match(words=[Word('dubious/JJ')]), Match(words=[Word('individual/JJ')]), Match(words=[Word('multiple/JJ')]), Match(words=[Word('specific/JJ')]), Match(words=[Word('interdependent/JJ')]), Match(words=[Word('sensitive/JJ')]), Match(words=[Word('belong/JJ')]), Match(words=[Word('evolutionary/JJ')]), Match(words=[Word('developmental/JJ')]), Match(words=[Word('evolutionary/JJ')]), Match(words=[Word('open/JJ')]), Match(words=[Word('cooperative/JJ')]), Match(words=[Word('polyphonic/JJ')]), Match(words=[Word('preserved.[4/JJ')]), Match(words=[Word('other/JJ')]), Match(words=[Word('cooperative/JJ')]), Match(words=[Word('worlding/JJ')]), Match(words=[Word('interesting/JJ')]), Match(words=[Word('such/JJ')]), Match(words=[Word('royal/JJ')]), Match(words=[Word('complex/JJ')]), Match(words=[Word('systemic/JJ')]), Match(words=[Word('rightful/JJ')]), Match(words=[Word('heretical/JJ')]), Match(words=[Word('apt/JJ')]), Match(words=[Word('cooperative/JJ')]), Match(words=[Word('positive/JJ')]), Match(words=[Word('business-as-usual/JJ')]), Match(words=[Word('academic/JJ')]), Match(words=[Word('capitalist/JJ')]), Match(words=[Word('socio-technical/JJ')]), Match(words=[Word('organizational/JJ')]), Match(words=[Word('business-as-usual/JJ')]), Match(words=[Word('horrific/JJ')]), Match(words=[Word('trusting/JJ')]), Match(words=[Word('capitalist/JJ')]), Match(words=[Word('wild/JJ')]), Match(words=[Word('natural/JJ')]), Match(words=[Word('blind/JJ')]), Match(words=[Word('rational/JJ')]), Match(words=[Word('sustainable/JJ')]), Match(words=[Word('prejudicial/JJ')]), Match(words=[Word('expendable/JJ')]), Match(words=[Word('willful/JJ')]), Match(words=[Word('trusting/JJ')]), Match(words=[Word('sufficient/JJ')]), Match(words=[Word('overbearing/JJ')]), Match(words=[Word('factual/JJ')]), Match(words=[Word('abstract/JJ')]), Match(words=[Word('situational/JJ')]), Match(words=[Word('oppose/JJ')]), Match(words=[Word('first/JJ')]), Match(words=[Word('interesting/JJ')]), Match(words=[Word('intriguing/JJ')]), Match(words=[Word('enlightening/JJ')]), Match(words=[Word('new/JJ')]), Match(words=[Word('possible/JJ')]), Match(words=[Word('new/JJ')]), Match(words=[Word('contemporary/JJ')]), Match(words=[Word('other/JJ')]), Match(words=[Word('trusting/JJ')]), Match(words=[Word('own/JJ')]), Match(words=[Word('reproducible/JJ')]), Match(words=[Word('such/JJ')]), Match(words=[Word('past/JJ')]), Match(words=[Word('challenge/JJ')]), Match(words=[Word('environmental/JJ')]), Match(words=[Word('social/JJ')]), Match(words=[Word('multiracial/JJ')]), Match(words=[Word('oppressed/JJ')]), Match(words=[Word('ancient/JJ')]), Match(words=[Word('ongoing/JJ')]), Match(words=[Word('future/JJ')]), Match(words=[Word('genuine/JJ')]), Match(words=[Word('Daring/JJ')]), Match(words=[Word('do/JJ')]), Match(words=[Word('uncertified/JJ')]), Match(words=[Word('improbable/JJ')]), Match(words=[Word('speculative/JJ')]), Match(words=[Word('future/JJ')]), Match(words=[Word('ludicrous/JJ')]), Match(words=[Word('free/JJ')]), Match(words=[Word('alternative/JJ')]), Match(words=[Word('condescending/JJ')]), Match(words=[Word('equivalent/JJ')]), Match(words=[Word('privileged/JJ')]), Match(words=[Word('involved/JJ')]), Match(words=[Word('interdependent/JJ')]), Match(words=[Word('always-situated/JJ')]), Match(words=[Word('generative/JJ')]), Match(words=[Word('liable/JJ')]), Match(words=[Word('new/JJ')]), Match(words=[Word('new/JJ')]), Match(words=[Word('scientific/JJ')]), Match(words=[Word('critical/JJ')]), Match(words=[Word('critical/JJ')]), Match(words=[Word('such/JJ')]), Match(words=[Word('liable/JJ')]), Match(words=[Word('new/JJ')]), Match(words=[Word('such/JJ')]), Match(words=[Word('scientific/JJ')]), Match(words=[Word('great/JJ')]), Match(words=[Word('worthy/JJ')]), Match(words=[Word('unworthy/JJ')]), Match(words=[Word('great/JJ')]), Match(words=[Word('certified/JJ')]), Match(words=[Word('i]Caliban/JJ')]), Match(words=[Word('Primitive/JJ')]), Match(words=[Word('Enemys/JJ')]), Match(words=[Word('i]Social/JJ')]), Match(words=[Word('Quarterly/JJ')]), Match(words=[Word('Dark/JJ')]), Match(words=[Word('Short/JJ')])]
In [83]:
search('VB DT NN', tree)
Out[83]:
[Match(words=[Word('take/VB'), Word('this/DT'), Word('motto/NN')]), Match(words=[Word('disqualify/VB'), Word('the/DT'), Word('resurgence/NN')]), Match(words=[Word('be/VB'), Word('the/DT'), Word('way/NN')]), Match(words=[Word('inherit/VB'), Word('the/DT'), Word('struggle/NN')]), Match(words=[Word('resist/VB'), Word('the/DT'), Word('idea/NN')]), Match(words=[Word('have/VB'), Word('the/DT'), Word('courage/NN')]), Match(words=[Word('accept/VB'), Word('this/DT'), Word('loss/NN')]), Match(words=[Word('be/VB'), Word('a/DT'), Word('question/NN')]), Match(words=[Word('have/VB'), Word('no/DT'), Word('power/NN')]), Match(words=[Word('signal/VB'), Word('an/DT'), Word('advance/NN')]), Match(words=[Word('generate/VB'), Word('the/DT'), Word('capacity/NN')]), Match(words=[Word('suspect/VB'), Word('some/DT'), Word('kind/NN')]), Match(words=[Word('suppress/VB'), Word('any/DT'), Word('temptation/NN')]), Match(words=[Word('doubt/VB'), Word('the/DT'), Word('kind/NN')]), Match(words=[Word('make/VB'), Word('a/DT'), Word('living/NN')]), Match(words=[Word('become/VB'), Word('an/DT'), Word('ally/NN')]), Match(words=[Word('weather/VB'), Word('the/DT'), Word('storm/NN')]), Match(words=[Word('recover/VB'), Word('the/DT'), Word('capacity/NN')])]
In [84]:
f = open("vbdtnn.html","w") n = 0 print("""<meta charset='utf-8'><link type="text/css" rel="stylesheet" href="body.css">""",file = f) print("choose your action:",file = f) for m in search ("VB DT NN", tree): print(f"<a href='page{n}.html'>{m.string}</a>",file = f) n = n + 1 f.close()
In [85]:
m.string
Out[85]:
'recover the capacity'
In [86]:
for m in search ("PRP$ *", tree): print (f"{m.string}")
their memory their power and practices their old rites their labour-power their activism their chant their return our future their fate its own destruction its specific responsibility their way his back his destiny their deconstruction its destruction their duty their method their fields their objectivity their position its own way our own reasons demands our reasons their own reasons their interest prevail his colleagues their participation its power its rightful object our business-as-usual academic routines our future our business-as-usual life our reasons its [ our future their part their own their maintenance our additions My Enemys Enemy i]The Quarterly Review
In [87]:
from pattern.en import wordnet
In [88]:
search('NN', tree)
Out[88]:
[Match(words=[Word('RESURGENCE/NN')]), Match(words=[Word('motto/NN')]), Match(words=[Word('cry/NN')]), Match(words=[Word('resurgence/NN')]), Match(words=[Word('memory/NN')]), Match(words=[Word('retrospective/NN')]), Match(words=[Word('power/NN')]), Match(words=[Word('matter/NN')]), Match(words=[Word('construction/NN')]), Match(words=[Word('understanding/NN')]), Match(words=[Word('destruction/NN')]), Match(words=[Word('appropriation/NN')]), Match(words=[Word('commons/NN')]), Match(words=[Word('rule/NN')]), Match(words=[Word('law/NN')]), Match(words=[Word('owner/NN')]), Match(words=[Word('invention/NN')]), Match(words=[Word('labour-power/NN')]), Match(words=[Word('market/NN')]), Match(words=[Word('commodity/NN')]), Match(words=[Word('Listening/NN')]), Match(words=[Word('cry/NN')]), Match(words=[Word('honour/NN')]), Match(words=[Word('vision/NN')]), Match(words=[Word('era/NN')]), Match(words=[Word('activism/NN')]), Match(words=[Word('memory/NN')]), Match(words=[Word('past/NN')]), Match(words=[Word('religion/NN')]), Match(words=[Word('goddess/NN')]), Match(words=[Word('judgement/NN')]), Match(words=[Word('resurgence/NN')]), Match(words=[Word('chant/NN')]), Match(words=[Word('goddess/NN')]), Match(words=[Word('return/NN')]), Match(words=[Word('return/NN')]), Match(words=[Word('goddess/NN')]), Match(words=[Word('regression/NN')]), Match(words=[Word('future/NN')]), Match(words=[Word('question/NN')]), Match(words=[Word('resurgence/NN')]), Match(words=[Word('future/NN')]), Match(words=[Word('order/NN')]), Match(words=[Word('something/NN')]), Match(words=[Word('way/NN')]), Match(words=[Word('way/NN')]), Match(words=[Word('fate/NN')]), Match(words=[Word('fate/NN')]), Match(words=[Word('price/NN')]), Match(words=[Word('progress/NN')]), Match(words=[Word('cascading/NN')]), Match(words=[Word('destruction/NN')]), Match(words=[Word('world/NN')]), Match(words=[Word('destruction/NN')]), Match(words=[Word('one/NN')]), Match(words=[Word('responsibility/NN')]), Match(words=[Word('formation/NN')]), Match(words=[Word('way/NN')]), Match(words=[Word('future/NN')]), Match(words=[Word('Resurgence/NN')]), Match(words=[Word('reappearance/NN')]), Match(words=[Word('something/NN')]), Match(words=[Word('pest/NN')]), Match(words=[Word('epidemic/NN')]), Match(words=[Word('vector/NN')]), Match(words=[Word('operation/NN')]), Match(words=[Word('eradication/NN')]), Match(words=[Word('landscape/NN')]), Match(words=[Word('catastrophe/NN')]), Match(words=[Word('exploitation/NN')]), Match(words=[Word('Today/NN')]), Match(words=[Word('reworlding/NN')]), Match(words=[Word('ecology/NN')]), Match(words=[Word('restoration/NN')]), Match(words=[Word('equilibrium/NN')]), Match(words=[Word('Ecology/NN')]), Match(words=[Word('association/NN')]), Match(words=[Word('reality/NN')]), Match(words=[Word('generalization/NN')]), Match(words=[Word('contrast/NN')]), Match(words=[Word('idea/NN')]), Match(words=[Word('regression/NN')]), Match(words=[Word('Man/NN')]), Match(words=[Word('Man/NN')]), Match(words=[Word('back/NN')]), Match(words=[Word('destiny/NN')]), Match(words=[Word('emancipation/NN')]), Match(words=[Word('order/NN')]), Match(words=[Word('nature/NN')]), Match(words=[Word('deconstruction/NN')]), Match(words=[Word('imperialist/NN')]), Match(words=[Word('colonialist/NN')]), Match(words=[Word('character/NN')]), Match(words=[Word('Man/NN')]), Match(words=[Word('motto/NN')]), Match(words=[Word('reference/NN')]), Match(words=[Word('progress/NN')]), Match(words=[Word('possibility/NN')]), Match(words=[Word('resurgence/NN')]), Match(words=[Word('materialist/NN')]), Match(words=[Word('secularist/NN')]), Match(words=[Word('position/NN')]), Match(words=[Word('resurgence/NN')]), Match(words=[Word('word/NN')]), Match(words=[Word('future/NN')]), Match(words=[Word('way/NN')]), Match(words=[Word('challenge/NN')]), Match(words=[Word('materialism/NN')]), Match(words=[Word('secularism/NN')]), Match(words=[Word('today/NN')]), Match(words=[Word('struggle/NN')]), Match(words=[Word('character/NN')]), Match(words=[Word('materialism/NN')]), Match(words=[Word('secularism/NN')]), Match(words=[Word('destruction/NN')]), Match(words=[Word('transition/NN')]), Match(words=[Word('capitalism/NN')]), Match(words=[Word('world.[1/NN')]), Match(words=[Word('idea/NN')]), Match(words=[Word('courage/NN')]), Match(words=[Word('loss/NN')]), Match(words=[Word('question/NN')]), Match(words=[Word('root/NN')]), Match(words=[Word('environment/NN')]), Match(words=[Word('way/NN')]), Match(words=[Word('destruction/NN')]), Match(words=[Word('fait/NN')]), Match(words=[Word('accompli/NN')]), Match(words=[Word('environment/NN')]), Match(words=[Word('fait/NN')]), Match(words=[Word('accompli/NN')]), Match(words=[Word('destruction/NN')]), Match(words=[Word('point/NN')]), Match(words=[Word('agreement/NN')]), Match(words=[Word('antagonist/NN')]), Match(words=[Word('fact/NN')]), Match(words=[Word('magic/NN')]), Match(words=[Word('practice/NN')]), Match(words=[Word('magic/NN')]), Match(words=[Word('cultural-subjective/NN')]), Match(words=[Word('construction/NN')]), Match(words=[Word('Objectivity/NN')]), Match(words=[Word('Subjectivity/NN')]), Match(words=[Word('banners[b/NN')]), Match(words=[Word('world/NN')]), Match(words=[Word('routine/NN')]), Match(words=[Word('methodology/NN')]), Match(words=[Word('duty/NN')]), Match(words=[Word('order/NN')]), Match(words=[Word('information/NN')]), Match(words=[Word('meaning/NN')]), Match(words=[Word('value/NN')]), Match(words=[Word('way/NN')]), Match(words=[Word('quest/NN')]), Match(words=[Word('approach/NN')]), Match(words=[Word('objectivity/NN')]), Match(words=[Word('subjectivity/NN')]), Match(words=[Word('way/NN')]), Match(words=[Word('method/NN')]), Match(words=[Word('knowledge/NN')]), Match(words=[Word('objectivity/NN')]), Match(words=[Word('banner/NN')]), Match(words=[Word('power/NN')]), Match(words=[Word('sense/NN')]), Match(words=[Word('achievement/NN')]), Match(words=[Word('objective/NN')]), Match(words=[Word('fact/NN')]), Match(words=[Word('questioning/NN')]), Match(words=[Word('objectivity/NN')]), Match(words=[Word('creation/NN')]), Match(words=[Word('situation/NN')]), Match(words=[Word('thing/NN')]), Match(words=[Word('power/NN')]), Match(words=[Word('interpretation/NN')]), Match(words=[Word('one/NN')]), Match(words=[Word('objectivity/NN')]), Match(words=[Word('name/NN')]), Match(words=[Word('event/NN')]), Match(words=[Word('outcome/NN')]), Match(words=[Word('method/NN')]), Match(words=[Word('lab/NN')]), Match(words=[Word('techno-social/NN')]), Match(words=[Word('milieu/NN')]), Match(words=[Word('world/NN')]), Match(words=[Word('claim/NN')]), Match(words=[Word('objectivity/NN')]), Match(words=[Word('lab/NN')]), Match(words=[Word('claim/NN')]), Match(words=[Word('operator/NN')]), Match(words=[Word('kind/NN')]), Match(words=[Word('objectivity/NN')]), Match(words=[Word('sheer/NN')]), Match(words=[Word('extraction/NN')]), Match(words=[Word('imposition/NN')]), Match(words=[Word('method/NN')]), Match(words=[Word('banner/NN')]), Match(words=[Word('conquest/NN')]), Match(words=[Word('hand/NN')]), Match(words=[Word('ground/NN')]), Match(words=[Word('subjectivity/NN')]), Match(words=[Word('objectivity/NN')]), Match(words=[Word('difference/NN')]), Match(words=[Word('sciences.[2/NN')]), Match(words=[Word('banner/NN')]), Match(words=[Word('subjectivity/NN')]), Match(words=[Word('turns/NN')]), Match(words=[Word('turn/NN')]), Match(words=[Word('t/NN')]), Match(words=[Word('help/NN')]), Match(words=[Word('advance/NN')]), Match(words=[Word('destruction/NN')]), Match(words=[Word('sense/NN')]), Match(words=[Word('contrast/NN')]), Match(words=[Word('resurgence/NN')]), Match(words=[Word('demoralization/NN')]), Match(words=[Word('perspective/NN')]), Match(words=[Word('advance/NN')]), Match(words=[Word('Demoralization/NN')]), Match(words=[Word('recognition/NN')]), Match(words=[Word('limit/NN')]), Match(words=[Word('possibility/NN')]), Match(words=[Word('possibility/NN')]), Match(words=[Word('feeling/NN')]), Match(words=[Word('legitimacy/NN')]), Match(words=[Word('objectivity/NN')]), Match(words=[Word('subjectivity/NN')]), Match(words=[Word('signal/NN')]), Match(words=[Word('process/NN')]), Match(words=[Word('resurgence/NN')]), Match(words=[Word('position/NN')]), Match(words=[Word('subjectivity/NN')]), Match(words=[Word('objectivity/NN')]), Match(words=[Word('dismemberment/NN')]), Match(words=[Word('sense[b/NN')]), Match(words=[Word('matter/NN')]), Match(words=[Word('way/NN')]), Match(words=[Word('mobilization/NN')]), Match(words=[Word('advance/NN')]), Match(words=[Word('knowledge/NN')]), Match(words=[Word('resurgence/NN')]), Match(words=[Word('situation/NN')]), Match(words=[Word('power/NN')]), Match(words=[Word('think/NN')]), Match(words=[Word('learning/NN')]), Match(words=[Word('process/NN')]), Match(words=[Word('situation/NN')]), Match(words=[Word('requirement/NN')]), Match(words=[Word('power/NN')]), Match(words=[Word('objective&slash;subjective/NN')]), Match(words=[Word('disjunction/NN')]), Match(words=[Word('way/NN')]), Match(words=[Word('process/NN')]), Match(words=[Word('ritual/NN')]), Match(words=[Word('bullet-point/NN')]), Match(words=[Word('instance/NN')]), Match(words=[Word('way/NN')]), Match(words=[Word('game/NN')]), Match(words=[Word('truth/NN')]), Match(words=[Word('power/NN')]), Match(words=[Word('position/NN')]), Match(words=[Word('addition/NN')]), Match(words=[Word('inspiration/NN')]), Match(words=[Word('instance/NN')]), Match(words=[Word('way/NN')]), Match(words=[Word('sweat/NN')]), Match(words=[Word('lodge/NN')]), Match(words=[Word('Today/NN')]), Match(words=[Word('share/NN')]), Match(words=[Word('reinvention/NN')]), Match(words=[Word('art/NN')]), Match(words=[Word('deliberation/NN')]), Match(words=[Word('issue/NN')]), Match(words=[Word('deliberation/NN')]), Match(words=[Word('power/NN')]), Match(words=[Word('sense/NN')]), Match(words=[Word('care/NN')]), Match(words=[Word('truth/NN')]), Match(words=[Word('power/NN')]), Match(words=[Word('agreement/NN')]), Match(words=[Word('process/NN')]), Match(words=[Word('party/NN')]), Match(words=[Word('experiment/NN')]), Match(words=[Word('capacity/NN')]), Match(words=[Word('feel/NN')]), Match(words=[Word('goddess/NN')]), Match(words=[Word('room/NN')]), Match(words=[Word('power/NN')]), Match(words=[Word('generativity/NN')]), Match(words=[Word('chant/NN')]), Match(words=[Word('everything/NN')]), Match(words=[Word('everything/NN')]), Match(words=[Word('honour/NN')]), Match(words=[Word('change/NN')]), Match(words=[Word('everything/NN')]), Match(words=[Word('way/NN')]), Match(words=[Word('conversion/NN')]), Match(words=[Word('i]She[i/NN')]), Match(words=[Word('course/NN')]), Match(words=[Word('trust/NN')]), Match(words=[Word('possibility/NN')]), Match(words=[Word('generativity/NN')]), Match(words=[Word('kind/NN')]), Match(words=[Word('role-playing/NN')]), Match(words=[Word('role/NN')]), Match(words=[Word('something/NN')]), Match(words=[Word('position/NN')]), Match(words=[Word('temptation/NN')]), Match(words=[Word('kind/NN')]), Match(words=[Word('authority/NN')]), Match(words=[Word('hesitation/NN')]), Match(words=[Word('betrayal/NN')]), Match(words=[Word('art/NN')]), Match(words=[Word('emergence/NN')]), Match(words=[Word('intensification/NN')]), Match(words=[Word('sensitivity/NN')]), Match(words=[Word('sensitivity/NN')]), Match(words=[Word('change/NN')]), Match(words=[Word('relationship/NN')]), Match(words=[Word('song[b/NN')]), Match(words=[Word('resurgence/NN')]), Match(words=[Word('situation/NN')]), Match(words=[Word('work/NN')]), Match(words=[Word('laboratory/NN')]), Match(words=[Word('redefinition/NN')]), Match(words=[Word('biology/NN')]), Match(words=[Word('abstraction/NN')]), Match(words=[Word('interest/NN')]), Match(words=[Word('prevail/NN')]), Match(words=[Word('living/NN')]), Match(words=[Word('none/NN')]), Match(words=[Word('biology.[3/NN')]), Match(words=[Word('song/NN')]), Match(words=[Word('singer/NN')]), Match(words=[Word('specialist/NN')]), Match(words=[Word('microbiology/NN')]), Match(words=[Word('character/NN')]), Match(words=[Word('composition/NN')]), Match(words=[Word('pattern/NN')]), Match(words=[Word('song/NN')]), Match(words=[Word('lab/NN')]), Match(words=[Word('field/NN')]), Match(words=[Word('life/NN')]), Match(words=[Word('participation/NN')]), Match(words=[Word('revolution/NN')]), Match(words=[Word('biology/NN')]), Match(words=[Word('heresy/NN')]), Match(words=[Word('challenge/NN')]), Match(words=[Word('creed/NN')]), Match(words=[Word('advance/NN')]), Match(words=[Word('science/NN')]), Match(words=[Word('biology/NN')]), Match(words=[Word('power/NN')]), Match(words=[Word('research/NN')]), Match(words=[Word('direction/NN')]), Match(words=[Word('song/NN')]), Match(words=[Word('assemblage/NN')]), Match(words=[Word('interdependence/NN')]), Match(words=[Word('extraction/NN')]), Match(words=[Word('isolation/NN')]), Match(words=[Word('road/NN')]), Match(words=[Word('progress/NN')]), Match(words=[Word('theory/NN')]), Match(words=[Word('i]a/NN')]), Match(words=[Word('priori[i/NN')]), Match(words=[Word('object/NN')]), Match(words=[Word('way/NN')]), Match(words=[Word('situation/NN')]), Match(words=[Word('biology/NN')]), Match(words=[Word('ally/NN')]), Match(words=[Word('resurgence/NN')]), Match(words=[Word('time/NN')]), Match(words=[Word('demobilization/NN')]), Match(words=[Word('s/NN')]), Match(words=[Word('proposition/NN')]), Match(words=[Word('future/NN')]), Match(words=[Word('life/NN')]), Match(words=[Word('place/NN')]), Match(words=[Word('resurgence/NN')]), Match(words=[Word('cultivation/NN')]), Match(words=[Word('art/NN')]), Match(words=[Word('attention/NN')]), Match(words=[Word('art/NN')]), Match(words=[Word('vigilance/NN')]), Match(words=[Word('relevance/NN')]), Match(words=[Word('risk/NN')]), Match(words=[Word('disaster/NN')]), Match(words=[Word('demand/NN')]), Match(words=[Word('precariousness/NN')]), Match(words=[Word('stable/NN')]), Match(words=[Word('Tsing/NN')]), Match(words=[Word('Matsutake/NN')]), Match(words=[Word('mushroom/NN')]), Match(words=[Word('extraction/NN')]), Match(words=[Word('exploitation/NN')]), Match(words=[Word('matter[I/NN')]), Match(words=[Word('Devastation/NN')]), Match(words=[Word('unravelling/NN')]), Match(words=[Word('life/NN')]), Match(words=[Word('deliberate/NN')]), Match(words=[Word('idea/NN')]), Match(words=[Word('case/NN')]), Match(words=[Word('mushroom/NN')]), Match(words=[Word('i]symbionts[i/NN')]), Match(words=[Word('knowledge/NN')]), Match(words=[Word('objectivity/NN')]), Match(words=[Word('subjectivity/NN')]), Match(words=[Word('light/NN')]), Match(words=[Word('situation/NN')]), Match(words=[Word('situation/NN')]), Match(words=[Word('woven[b/NN')]), Match(words=[Word('future/NN')]), Match(words=[Word('possibility/NN')]), Match(words=[Word('resurgence/NN')]), Match(words=[Word('possibility/NN')]), Match(words=[Word('name/NN')]), Match(words=[Word('extraction/NN')]), Match(words=[Word('web/NN')]), Match(words=[Word('generativity.[6/NN')]), Match(words=[Word('cultivation/NN')]), Match(words=[Word('interdependence/NN')]), Match(words=[Word('precariousness/NN')]), Match(words=[Word('part/NN')]), Match(words=[Word('growth/NN')]), Match(words=[Word('selection/NN')]), Match(words=[Word('off-ground/NN')]), Match(words=[Word('resurgence/NN')]), Match(words=[Word('return/NN')]), Match(words=[Word('climate/NN')]), Match(words=[Word('justice/NN')]), Match(words=[Word('i]Alliance/NN')]), Match(words=[Word('alliances[i/NN')]), Match(words=[Word('gender/NN')]), Match(words=[Word('colour/NN')]), Match(words=[Word('resistance/NN')]), Match(words=[Word('storm/NN')]), Match(words=[Word('need/NN')]), Match(words=[Word('honour/NN')]), Match(words=[Word('struggle/NN')]), Match(words=[Word('for.[7/NN')]), Match(words=[Word('commons/NN')]), Match(words=[Word('world/NN')]), Match(words=[Word('name/NN')]), Match(words=[Word('property/NN')]), Match(words=[Word('commons/NN')]), Match(words=[Word('need/NN')]), Match(words=[Word('capacity/NN')]), Match(words=[Word('concern/NN')]), Match(words=[Word('care/NN')]), Match(words=[Word('maintenance/NN')]), Match(words=[Word('commons.[8/NN')]), Match(words=[Word('Resurgence/NN')]), Match(words=[Word('word/NN')]), Match(words=[Word('option/NN')]), Match(words=[Word('future/NN')]), Match(words=[Word('trust/NN')]), Match(words=[Word('today/NN')]), Match(words=[Word('s/NN')]), Match(words=[Word('possibility/NN')]), Match(words=[Word('worth/NN')]), Match(words=[Word('option/NN')]), Match(words=[Word('today/NN')]), Match(words=[Word('standing/NN')]), Match(words=[Word('place/NN')]), Match(words=[Word('skepticism/NN')]), Match(words=[Word('resurgence/NN')]), Match(words=[Word('option/NN')]), Match(words=[Word('ground/NN')]), Match(words=[Word('soil/NN')]), Match(words=[Word('commons/NN')]), Match(words=[Word('abstraction/NN')]), Match(words=[Word('process/NN')]), Match(words=[Word('matter/NN')]), Match(words=[Word('song/NN')]), Match(words=[Word('song/NN')]), Match(words=[Word('attention/NN')]), Match(words=[Word('concern/NN')]), Match(words=[Word('attention/NN')]), Match(words=[Word('song/NN')]), Match(words=[Word('question/NN')]), Match(words=[Word('pluriverse/NN')]), Match(words=[Word('rise/NN')]), Match(words=[Word('fall/NN')]), Match(words=[Word('value/NN')]), Match(words=[Word('question/NN')]), Match(words=[Word('answer/NN')]), Match(words=[Word('difference/NN')]), Match(words=[Word('world/NN')]), Match(words=[Word('manner/NN')]), Match(words=[Word('difference/NN')]), Match(words=[Word('Enemy/NN')]), Match(words=[Word('doi:10.2307&slash;466844/NN')]), Match(words=[Word('I./NN')]), Match(words=[Word('doi:10.1086&slash;668166/NN')]), Match(words=[Word('Song/NN')]), Match(words=[Word('i]Biology/NN')]), Match(words=[Word('End/NN')]), Match(words=[Word('Sex/NN')]), Match(words=[Word('Introduction/NN')]), Match(words=[Word('i]Pragmatism/NN')]), Match(words=[Word('Name/NN')])]
In [89]:
sense = wordnet.synsets("language")[0]
In [90]:
sense.hypernym
Out[90]:
Synset('communication.n.02')
In [78]:
output = [] search_word="person" for search_word in search_word.split('|'): synset = wordnet.synsets(search_word)[0] pos = synset.pos possible_words = search(pos, tree) for match in possible_words: # print (f"match {match}") word = match[0].string synsets = wordnet.synsets(word) if len(synsets) > 0: hypernyms = synsets[0].hypernyms(recursive=True) if any(search_word == h.senses[0] for h in hypernyms): print(f"matching {word}") output.append(word)
matching owner matching Man matching Man matching imperialist matching colonialist matching Man matching materialist matching secularist matching antagonist matching singer matching specialist
In [79]:
output
Out[79]:
['owner', 'Man', 'Man', 'imperialist', 'colonialist', 'Man', 'materialist', 'secularist', 'antagonist', 'singer', 'specialist']
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]: