SALT-NLP/multi-value

Running single transform functions on new strings

Closed this issue · 1 comments

Hi,

Cool project!

I would like to run some of your single transform functions on my own documents. I tested the first function in Table 7 in your paper "she_inanimate_objects" (https://aclanthology.org/2023.acl-long.44.pdf), which according to the table should transform "It's a good bike" to "She’s a good bike". Instead I am getting back the same text "It's a good bike". Interestingly it does work for the test case in tests.py: "You gave me this bike and it's a good bike" is transformed to "You gave me this bike and she's a good bike".

Informed by your tests.py file I am currently running the code like this:

import src.Dialects

sae_text = "It's a good bike"
D = src.Dialects.DialectFromVector(dialect_name="all")
D.clear()
D.update(sae_text)
method = getattr(D, "she_inanimate_objects")
method()
transformed_text = D.surface_fix_spacing(D.compile_from_rules())

What is going wrong?

Hi Anna! Sorry for the delayed response, we've been refactoring this code base a bit for PyPi.

The easiest way to run just a single feature is using DialectFromFeatureList. Here's an example (unfortunately, our underlying coreference library Stanza is missing the coreference for "It's a good bike" in the newest version, so I've put a demo where Stanza is working appropriately.)

from multivalue.Dialects import DialectFromFeatureList
d = DialectFromFeatureList(feature_list=["she_inanimate_objects"])
print(d.transform("My bike, it's a good bike."))