Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyjurg committed Sep 10, 2023
2 parents ecc665e + fc602e5 commit 741a490
Show file tree
Hide file tree
Showing 120 changed files with 7,685,310 additions and 13,488 deletions.
2 changes: 1 addition & 1 deletion app/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ provenanceSpec:
corpus: '{org} - {repo}{relative}'
doi: 10.5281/zenodo.notyet
moduleSpecs: []
version: 0.5.1
version: 0.5.2
webBase: https://public.{org}.org/{repo}
webHint: Show this on the website
webLang: en
Expand Down
137 changes: 86 additions & 51 deletions lowfat.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ def convertTaskCustom(self):
slotType = "word"
otext = {
"fmt:text-orig-full": "{before}{text}{after}",
"fmt:text-orig-clean": "{text}{punctuation}",
"fmt:text-orig-plain": "{text}{punctuation}",
"sectionTypes": "book,chapter,verse",
"sectionFeatures": "book,chapter,verse",
"levelConstraints": "clause < group",
}
monoAtts = {"appositioncontainer", "articular", "discontinuous"}

Expand Down Expand Up @@ -215,6 +216,7 @@ def getDirector(self):
xml
p
milestone
sentence
""".strip().split()
)

Expand Down Expand Up @@ -275,16 +277,16 @@ def walkNode(cv, cur, xnode):
superNode = curNode

if superNode is not None:
nest = superNode[0] in {"phrase", "clause", "word"}
nest = superNode[0] in {"phrase", "clause", "word", "sentence", "group"}
else:
nest = False

#condition for nesting extraNode phrase and clause
if extraNode is not None:
'''if extraNode is not None:
nestablePhraseClause = extraNode[0] in {"phrase", "clause"}
else:
nestablePhraseClause = False
nestablePhraseClause = False'''

if curNode is not None:
#parent features for curNode word and wg
if len(cur[TNEST]):
Expand All @@ -293,12 +295,12 @@ def walkNode(cv, cur, xnode):
cv.edge(curNode, parentNode, parent=None)

#parent features for extraNode phrase and clause
if len(cur['extraParent']):
'''if len(cur['extraParent']):
if nestablePhraseClause:
parentNode = cur['extraParent'][-1]
cv.edge(extraNode, parentNode, parent=None)
cv.edge(extraNode, parentNode, parent=None)'''

#parent features for extraNode phrase and clause
#parent features for superNode phrase, clause, word, sentence and group
if len(cur['superParentNode']):
if nest:
parentNode = cur['superParentNode'][-1]
Expand All @@ -307,12 +309,12 @@ def walkNode(cv, cur, xnode):
cur[TNEST].append(curNode) #gleaning all the previous curNodes

#gleaning all the previous extraNode
if curNode[0] == 'wg':
'''if curNode[0] == 'wg':
Node = extraNode
else:
Node = curNode
cur['extraParent'].append(Node)
cur['extraParent'].append(Node)'''

cur['superParentNode'].append(superNode) #gleaning all the previous superNodes

Expand All @@ -324,7 +326,7 @@ def walkNode(cv, cur, xnode):
cv.edge(sib, curNode, sibling=nSiblings - i)
siblings.append(curNode)

if len(cur['extraSib']):
'''if len(cur['extraSib']):
if nestablePhraseClause:
siblings = cur['extraSib'][-1]
nSiblings = len(siblings)
Expand All @@ -334,9 +336,19 @@ def walkNode(cv, cur, xnode):
else:
Node = curNode
cv.edge(sib, Node, sibling=nSiblings - i)
siblings.append(Node)
siblings.append(Node)'''

if len(cur['superSib']):
if nest:
siblings = cur['superSib'][-1]
nSiblings = len(siblings)
for (i, sib) in enumerate(siblings):
cv.edge(sib, superNode, sibling=nSiblings - i)
siblings.append(superNode)

cur['superSib'].append([])

cur['extraSib'].append([])
'''cur['extraSib'].append([])'''

cur[TSIB].append([])

Expand All @@ -354,16 +366,21 @@ def walkNode(cv, cur, xnode):
if len(cur[TSIB]):
cur[TSIB].pop()

if extraNode is not None:
'''if extraNode is not None:
if len(cur['extraParent']):
cur['extraParent'].pop()
if len(cur['extraSib']):
cur['extraSib'].pop()
cur['extraSib'].pop()'''

if superNode is not None:
if superNode is not None:
if len(cur['superParentNode']):
cur['superParentNode'].pop()
if len(cur['superSib']):
cur['superSib'].pop()

if cur[TNEST] == []:
cv.terminate(curNode)

cur[XNEST].pop()
afterTag(cv, cur, xnode, tag)

Expand Down Expand Up @@ -609,7 +626,7 @@ def beforeChildren(cv, cur, xnode, tag):
cur["clNum"] += 1 #counting the number of the clauses
atts["num"] = cur["clNum"]
atts['book'] = cur['book']

else:
extraType = "phrase" #generate phrase container for the words within the wg tag

Expand All @@ -626,48 +643,60 @@ def beforeChildren(cv, cur, xnode, tag):
atts["rela"] = "Appo"

else:
if clauseType == "nominalized":
extraType = "clause" #generate clause container from the clauseType attribute
if rule == "NpaNp":
extraType = "phrase"

cur["phraseNum"] += 1 #counting the number of the phrases
atts["num"] = cur["phraseNum"]

#generate clause container for specific attributes
elif clauseType == "nominalized" or cltype is not None or crule is not None:
extraType = "clause"

cur["clNum"] += 1 #counting the number of the clauses
cur["clNum"] += 1
atts["num"] = cur["clNum"]
atts['book'] = cur['book']

elif type == "wrapper-clause-scope":
extraType = "clause" #generate clause container from the wrapper-clause-scope type of the word group
#generate sentence container for specific attributes
elif type == "wrapper-clause-scope" or type == "modifier-clause-scope":
extraType = "sentence"

cur["clNum"] += 1 #counting the number of the clauses
atts["num"] = cur["clNum"]
cur["sentNum"] += 1
atts["num"] = cur["sentNum"]
atts['book'] = cur['book']

elif type == "modifier-clause-scope":
extraType = "clause" #generate clause container from the wrapper-clause-scope type of the word group
elif rule in ["ClaCl", "ClCl", "ClClCl", "ClClClCl", "ClClClClCl", "ClClClClClCl",
"ClClClClClClCl", "ClClClClClClClCl", "ClClClClClClClClCl",
"ClClClClClClClClCl", "ClClClClClClClClClCl", "ClClClClClClClClClClClCl", "ClCl2"]:
extraType = "sentence"

cur["clNum"] += 1 #counting the number of the clauses
atts["num"] = cur["clNum"]

elif type == "conjuncted-wg":
extraType = "clause" #generate clause container from the conjuncted type of the word group
atts["typ"] = "conjuncted"
cur["sentNum"] += 1
atts["num"] = cur["sentNum"]
atts['book'] = cur['book']

cur["clNum"] += 1 #counting the number of the clauses
atts["num"] = cur["clNum"]
elif rule is not None and len(atts) == 1:
extraType = "sentence"

elif rule == "ClaCl":
extraType = "clause" #generate clause container from the clause-a-clause type of the word group
cur["sentNum"] += 1
atts["num"] = cur["sentNum"]
atts['book'] = cur['book']

cur["clNum"] += 1 #counting the number of the clauses
atts["num"] = cur["clNum"]
#generate group container for specific attributes
elif type == "conjuncted-wg":
extraType = "group"
atts["typ"] = "conjuncted"

elif cltype is not None:
extraType = "clause" #generate clause container from if there is a clytype attribute for the word group
cur["groupNum"] += 1
atts["num"] = cur["groupNum"]
atts['book'] = cur['book']

cur["clNum"] += 1 #counting the number of the clauses
atts["num"] = cur["clNum"]

elif crule is not None:
extraType = "clause" #generate clause container from if there is a crule attribute for the word group
elif type == "apposition-group":
extraType = "group"
atts["typ"] = "apposition"

cur["clNum"] += 1 #counting the number of the clauses
atts["num"] = cur["clNum"]
cur["groupNum"] += 1
atts["num"] = cur["groupNum"]
atts['book'] = cur['book']

else:
extraType = "phrase" #generate phrase container for the words that the clause feature is None
Expand All @@ -688,6 +717,9 @@ def beforeChildren(cv, cur, xnode, tag):
curNode = cv.node(tag)
cv.feature(curNode, **atts)

if len(cur['superParentNode']) == 1 and extraType != "sentence": #defining the sentence container at the beginning of the root
extraType = "sentence"

if extraType is not None:
extraNode = cv.node(extraType)
if len(atts):
Expand Down Expand Up @@ -726,8 +758,9 @@ def afterChildren(cv, cur, xnode, tag):

if len(cur[TNEST]):
curNode = cur[TNEST][-1]
cv.terminate(curNode)

if curNode[0] != 'book':
cv.terminate(curNode)

def afterTag(cv, cur, xnode, tag):
"""Node actions after dealing with the children and after the end tag.
Expand Down Expand Up @@ -787,7 +820,8 @@ def director(cv):
cur['book'] = None
cur["chapter"] = None
cur["verse"] = None
cur["sentNum"] = 0
cur["sentNum"] = 0 #define number of the sentence
cur["groupNum"] = 0 #define number of the group
cur["clNum"] = 0 #define number of the clause
cur["phraseNum"] = 0 #define number of the phrase
cur["subphraseNum"] = 0 #define number of the subphrase
Expand All @@ -796,7 +830,8 @@ def director(cv):
cur["frameEdges"] = []
cur["extraParent"] = [] #define dictionary that carries all the previous extraNodes
cur["extraSib"] = [] #define dictionary that carries all the siblings with extraNodes
cur["superParentNode"] = []
cur["superParentNode"] = [] #define dictionary that carries all the previous superNodes
cur['superSib'] = [] #define dictionary that carries all the siblings with superNodes
walkNode(cv, cur, root)

xIdIndex = cur["xIdIndex"]
Expand Down
Binary file added tf/0.5.2/.tf/3/__boundary__.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/__characters__.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/__levDown__.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/__levUp__.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/__levels__.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/__order__.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/__rank__.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/__sections__.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/__structure__.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/after.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/appositioncontainer.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/articular.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/before.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/book.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/book_short.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/case.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/chapter.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/clauseType.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/cls.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/cltype.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/criticalsign.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/crule.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/degree.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/discontinuous.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/domain.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/frame.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/framespec.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/function.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/gender.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/gloss.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/id.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/junction.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/lang.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/lemma.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/ln.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/mood.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/morph.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/nodeId.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/normalized.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/note.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/num.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/number.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/oslots.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/otype.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/parent.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/person.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/punctuation.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/ref.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/referent.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/rela.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/role.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/rule.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/sibling.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/strong.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/subjref.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/subjrefspec.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/tense.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/text.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/typ.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/type.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/unicode.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/verse.tfx
Binary file not shown.
Binary file added tf/0.5.2/.tf/3/voice.tfx
Binary file not shown.
Loading

0 comments on commit 741a490

Please sign in to comment.