You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by scpedicini June 3, 2024
I think I'm doing something wrong with the newer compromise/three. termList/out/etc. works great, but if I use them in conjunction with toNumbers the data seems to mutate in place.
Trying to do this:
consttext_1="There are twenty-four apples and 12000 oranges on the table.";constnat=nlp(text_1);constnumber_of_numerical_values=nat.values().length;// shows a length of two which is what we would expect so far so goodconsttermList_1=nat.values(0).toNumber().termList();console.log(termList_1);// termList_1 has converted the number "twenty-four" to "24" but also has// `"apples", "and", "12000", "oranges", "on", "the", "table"` in array// rerun exact same commandconsttermList_2=nat.values(0).toNumber().termList();console.log(termList_2);// termList_2 now has the expected array of just "3" // converted to numerical
I basically want to go through each numerically recognized "group" hence using the .values() command and use the toNumbers() command to reduce them down to the numerical number.
Picture to help indicate the issue:
The text was updated successfully, but these errors were encountered:
@spencermountain Thanks for taking a look. Just wanted to add some information around this as well - near as I can tell it happens pretty consistently with out, json, termList, etc.
constnat=nlp('There were 24 apples and 12000 oranges on the table.');
Discussed in #1112
Originally posted by scpedicini June 3, 2024
I think I'm doing something wrong with the newer
compromise/three
.termList
/out
/etc. works great, but if I use them in conjunction withtoNumbers
the data seems to mutate in place.Trying to do this:
I basically want to go through each numerically recognized "group" hence using the
.values()
command and use thetoNumbers()
command to reduce them down to the numerical number.Picture to help indicate the issue:
The text was updated successfully, but these errors were encountered: