Skip to content

Commit

Permalink
adding function to compute frame lengths #39
Browse files Browse the repository at this point in the history
  • Loading branch information
leoalenc committed Jan 4, 2022
1 parent f919564 commit 4f3b388
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions etc/valence_script/ValenceExtractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
FRAMES=list(VALENCES.keys())
MAPPING=from_frames_to_types()

def compute_stats(frames=FRAMES):
frame_lens=[(frame,len(frame.split(","))) for frame in frames]
max_len=max(flen for f,flen in frame_lens)
dic={}
for n in range(1,max_len+1):
for f,flen in frame_lens:
if flen == n:
if dic.get(flen):
dic[n]+=1
else:
dic[n]=1
for k,v in dic.items():
print(k,v)


def parse_frame(frame):
match=re.match(r"<(.+)>",frame)
if match:
Expand Down

0 comments on commit 4f3b388

Please sign in to comment.