Skip to content

Commit

Permalink
Rename MWE patterns for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
meghdadFar committed Apr 8, 2024
1 parent d90c129 commit 5cd378c
Showing 1 changed file with 60 additions and 36 deletions.
96 changes: 60 additions & 36 deletions wordview/mwes/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,80 @@
class EnMWEPatterns:
patterns: Dict[str, List[str]] = {}

def __init__(self, mwe_types=["LVC", "NC2", "NC3", "ANC2", "ANC3", "VPC"]):
if "LVC" in mwe_types:
self.patterns["LVC"] = [
"LVC: {<VB*><DT><\\w+>}",
def __init__(
self,
mwe_types=[
"Light Verb Constructions",
"Noun Noun Compounds",
"Noun Noun Noun Compounds",
"Adjective Noun Compounds",
"Adjective Adjective Noun Compounds",
"Verb Particle Constructions",
],
):
if "Light Verb Constructions" in mwe_types:
self.patterns["Light Verb Constructions"] = [
"Light Verb Constructions: {<VB*><DT><\\w+>}",
]
if "NC2" in mwe_types:
self.patterns["NC2"] = [
"NC2: {<NN|NNS><NN|NNS>}",
if "Noun Noun Compounds" in mwe_types:
self.patterns["Noun Noun Compounds"] = [
"Noun Noun Compounds: {<NN|NNS><NN|NNS>}",
]
if "NC3" in mwe_types:
self.patterns["NC3"] = [
"NC3: {<NN|NNS><NN|NNS><NN|NNS>}",
if "Noun Noun Noun Compounds" in mwe_types:
self.patterns["Noun Noun Noun Compounds"] = [
"Noun Noun Noun Compounds: {<NN|NNS><NN|NNS><NN|NNS>}",
]
if "ANC2" in mwe_types:
self.patterns["ANC2"] = [
"ANC2: {<JJ><NN|NNS>}",
if "Adjective Noun Compounds" in mwe_types:
self.patterns["Adjective Noun Compounds"] = [
"Adjective Noun Compounds: {<JJ><NN|NNS>}",
]
if "ANC3" in mwe_types:
self.patterns["ANC3"] = ["ANC3: {<JJ><JJ><NN|NNS>}"]
if "VPC" in mwe_types:
self.patterns["VPC"] = [
"VPC: {<VB|VBP><RP>}",
if "Adjective Adjective Noun Compounds" in mwe_types:
self.patterns["Adjective Adjective Noun Compounds"] = [
"Adjective Adjective Noun Compounds: {<JJ><JJ><NN|NNS>}"
]
if "Verb Particle Constructions" in mwe_types:
self.patterns["Verb Particle Constructions"] = [
"Verb Particle Constructions: {<VB|VBP><RP>}",
]


class DeMWEPatterns:
patterns: Dict[str, List[str]] = {}

def __init__(self, mwe_types=["LVC", "NC2", "NC3", "ANC2", "ANC3", "VPC"]):
if "LVC" in mwe_types:
self.patterns["LVC"] = [
"LVC: {<VB*><DT><\\w+>}",
def __init__(
self,
mwe_types=[
"Light Verb Constructions",
"Noun Noun Compounds",
"Noun Noun Noun Compounds",
"Adjective Noun Compounds",
"Adjective Adjective Noun Compounds",
"Verb Particle Constructions",
],
):
if "Light Verb Constructions" in mwe_types:
self.patterns["Light Verb Constructions"] = [
"Light Verb Constructions: {<VB*><DT><\\w+>}",
]
# Define the patterns for 2 and 3-word noun compounds (e.g., "Hausaufgaben", "Fußballplatz")
if "NC2" in mwe_types:
self.patterns["NC2"] = [
"NC2: {<NN|NNS><NN|NNS>}",
if "Noun Noun Compounds" in mwe_types:
self.patterns["Noun Noun Compounds"] = [
"Noun Noun Compounds: {<NN|NNS><NN|NNS>}",
]
if "Noun Noun Noun Compounds" in mwe_types:
self.patterns["Noun Noun Noun Compounds"] = [
"Noun Noun Noun Compounds: {<NN|NNS><NN|NNS><NN|NNS>}",
]
if "NC3" in mwe_types:
self.patterns["NC3"] = [
"NC3: {<NN|NNS><NN|NNS><NN|NNS>}",
if "Adjective Noun Compounds" in mwe_types:
self.patterns["Adjective Noun Compounds"] = [
"Adjective Noun Compounds: {<JJ><NN|NNS>}",
]
if "ANC2" in mwe_types:
self.patterns["ANC2"] = [
"ANC2: {<JJ><NN|NNS>}",
if "Adjective Adjective Noun Compounds" in mwe_types:
self.patterns["Adjective Adjective Noun Compounds"] = [
"Adjective Adjective Noun Compounds: {<JJ><JJ><NN|NNS>}"
]
if "ANC3" in mwe_types:
self.patterns["ANC3"] = ["ANC3: {<JJ><JJ><NN|NNS>}"]
# Define the patterns for verb particle constructions (e.g., "aufstehen", "zurückkommen")
if "VPC" in mwe_types:
self.patterns["VPC"] = [
"VPC: {<VB|VBP><RP>}",
if "Verb Particle Constructions" in mwe_types:
self.patterns["Verb Particle Constructions"] = [
"Verb Particle Constructions: {<VB|VBP><RP>}",
]

0 comments on commit 5cd378c

Please sign in to comment.