-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
184 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import copy | ||
from sastadev.sastatypes import SynTree | ||
from sastadev.treebankfunctions import find1 | ||
|
||
|
||
nognietxpath = """.//node[@cat="advp" and node[@rel="mod" and @lemma="nog"] and node[@rel="hd" and @lemma="niet"]]""" | ||
zelfinnpmodxpath = """.//node[@rel="mod" and @lemma="zelf" and parent::node[@cat="np"]]""" | ||
|
||
def nognietsplit(stree: SynTree) -> SynTree: | ||
newstree = copy.deepcopy(stree) | ||
nognietnodes = newstree.xpath(nognietxpath) | ||
if nognietnodes == []: | ||
return stree | ||
for nognietnode in nognietnodes: | ||
nog = find1(nognietnode, """./node[@lemma="nog"]""") | ||
nognietnodeparent = nognietnode.getparent() | ||
nognietnode.remove(nog) | ||
for i, anode in enumerate(nognietnodeparent): | ||
if anode == nognietnode: | ||
nognietnodepos = i | ||
break | ||
nognietnodeparent[i] = nognietnode | ||
return newstree | ||
|
||
|
||
def ikzelfsplit(stree: SynTree) -> SynTree: | ||
newstree = copy.deepcopy(stree) | ||
zelfinnps = newstree.xpath(zelfinnpmodxpath) | ||
if zelfinnps == []: | ||
return stree | ||
for zelfinnp in zelfinnps: | ||
npnode = zelfinnp.getparent() | ||
npparentnode = npnode.getparent() | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters