From dcc0695f9d008cab09b3db7c22828fdb541b737c Mon Sep 17 00:00:00 2001 From: Houjun Liu Date: Fri, 8 Dec 2023 00:31:24 -0800 Subject: [PATCH] fixing casing --- baln/cli.py | 4 ++-- baln/ud.py | 17 ++++++++++++----- meta.yaml | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/baln/cli.py b/baln/cli.py index 6681262..955bbc1 100644 --- a/baln/cli.py +++ b/baln/cli.py @@ -4,8 +4,8 @@ from multiprocessing import Process, freeze_support -VERSION="0.3.58" -NOTES="enabling old utterance model" +VERSION="0.3.59" +NOTES="fixing various UD casings" #################### OPTIONS ################################ diff --git a/baln/ud.py b/baln/ud.py index f3d39d2..d092d5e 100644 --- a/baln/ud.py +++ b/baln/ud.py @@ -127,10 +127,10 @@ def handler__PRON(word): person = '4' # parse - return (handler(word)+"-"+ - feats.get("PronType", "Int")+"-"+ - feats.get("Case", "Acc").replace(",", "")+"-"+ - feats.get("Number", "S")[0]+person) + return (handler(word)+ + stringify_feats(feats.get("PronType", "Int"), + feats.get("Case","").replace(",", ""), + feats.get("Number", "")[:1]+person)) def handler__DET(word): # get the features @@ -138,8 +138,15 @@ def handler__DET(word): feats = parse_feats(word) except AttributeError: return handler(word) + + # get gender and numer + gender_str = "&"+feats.get("Gender", "").replace(",", "") + + # clear defaults + if gender_str == "&Com,Neut" or gender_str == "&Com" or gender_str=="&": gender_str="" + # parse - return (handler(word)+"-"+ + return (handler(word)+gender_str+"-"+ feats.get("Definite", "Def") + stringify_feats(feats.get("PronType", ""))) def handler__ADJ(word): diff --git a/meta.yaml b/meta.yaml index 1e921c6..092da8d 100644 --- a/meta.yaml +++ b/meta.yaml @@ -1,5 +1,5 @@ {% set name = "batchalign" %} -{% set version = "0.3.58" %} +{% set version = "0.3.59" %} package: name: {{ name }}