pylangacq
pylangacq copied to clipboard
reader.ipsyn() crashes for ~100 files
Describe the bug
import pylangacq
file_cha = f"{dir_talkbank_media}/childes/Biling/YipMatthews/Eng/DarrenEng/020429.cha"
reader = pylangacq.read_chat(file_cha)
ret = reader.ipsyn() # crash
Relevant CHILDES or TalkBank data childes/Biling/YipMatthews/Eng/DarrenEng/020429.cha
Screenshots
File "/pathto/talkbank_utils.py", line 360, in bug_D20240408T230411
ret = reader.ipsyn()
File "/home/timothee/.conda/envs/speakerid_cuda/lib/python3.10/site-packages/pylangacq/chat.py", line 886, in ipsyn
return _get_ipsyn(
File "/home/timothee/.conda/envs/speakerid_cuda/lib/python3.10/site-packages/pylangacq/measures.py", line 133, in _get_ipsyn
result_by_files.append(_get_ipsyn_for_file(tagged_sents_for_file))
File "/home/timothee/.conda/envs/speakerid_cuda/lib/python3.10/site-packages/pylangacq/measures.py", line 1559, in _get_ipsyn_for_file
def S17(graph):
File "/home/timothee/.conda/envs/speakerid_cuda/lib/python3.10/site-packages/pylangacq/measures.py", line 300, in test_item
item_function(sent_graph)
File "/home/timothee/.conda/envs/speakerid_cuda/lib/python3.10/site-packages/pylangacq/measures.py", line 1577, in S17
main_verb = graph.edges()[inf_verb] # "wants"
KeyError: 0
note
this cha file gives a different stacktrace:
import pylangacq
file_cha = f"{dir_talkbank_media}/childes/Biling/CHCC/Luna/English/031029s.cha"
reader = pylangacq.read_chat(file_cha)
ret = reader.ipsyn() # crash
AttributeError: '_DependencyGraph' object has no attribute 'nodes'. Did you mean: 'node'?
Traceback (most recent call last):
File "/pathto/talkbank_utils.py", line 376, in bug_D20240408T230411_v2
ret = reader.ipsyn() # crash
File "/home/timothee/.conda/envs/speakerid_cuda/lib/python3.10/site-packages/pylangacq/chat.py", line 886, in ipsyn
return _get_ipsyn(
File "/home/timothee/.conda/envs/speakerid_cuda/lib/python3.10/site-packages/pylangacq/measures.py", line 133, in _get_ipsyn
result_by_files.append(_get_ipsyn_for_file(tagged_sents_for_file))
File "/home/timothee/.conda/envs/speakerid_cuda/lib/python3.10/site-packages/pylangacq/measures.py", line 1441, in _get_ipsyn_for_file
def S13(graph):
File "/home/timothee/.conda/envs/speakerid_cuda/lib/python3.10/site-packages/pylangacq/measures.py", line 300, in test_item
item_function(sent_graph)
File "/home/timothee/.conda/envs/speakerid_cuda/lib/python3.10/site-packages/pylangacq/measures.py", line 1454, in S13
if dep + 1 in graph.nodes() and graph.node[dep + 1]["word"] == "INF":
AttributeError: '_DependencyGraph' object has no attribute 'nodes'. Did you mean: 'node'?