Make compparuson out to TOKLEN only explicit in vocab lookups.
This commit is contained in:
parent
278e9c8240
commit
d998965faf
1 changed files with 4 additions and 4 deletions
8
misc.c
8
misc.c
|
@ -462,7 +462,7 @@ int get_motion_vocab_id(const char* word)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NMOTIONS; ++i) {
|
for (int i = 0; i < NMOTIONS; ++i) {
|
||||||
for (int j = 0; j < motions[i].words.n; ++j) {
|
for (int j = 0; j < motions[i].words.n; ++j) {
|
||||||
if (strcasecmp(word, motions[i].words.strs[j]) == 0 && (strlen(word) > 1 ||
|
if (strncasecmp(word, motions[i].words.strs[j], TOKLEN) == 0 && (strlen(word) > 1 ||
|
||||||
strchr(ignore, word[0]) == NULL ||
|
strchr(ignore, word[0]) == NULL ||
|
||||||
!settings.oldstyle))
|
!settings.oldstyle))
|
||||||
return (i);
|
return (i);
|
||||||
|
@ -477,7 +477,7 @@ int get_object_vocab_id(const char* word)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NOBJECTS + 1; ++i) { // FIXME: the + 1 should go when 1-indexing for objects is removed
|
for (int i = 0; i < NOBJECTS + 1; ++i) { // FIXME: the + 1 should go when 1-indexing for objects is removed
|
||||||
for (int j = 0; j < objects[i].words.n; ++j) {
|
for (int j = 0; j < objects[i].words.n; ++j) {
|
||||||
if (strcasecmp(word, objects[i].words.strs[j]) == 0)
|
if (strncasecmp(word, objects[i].words.strs[j], TOKLEN) == 0)
|
||||||
return (i);
|
return (i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -490,7 +490,7 @@ int get_action_vocab_id(const char* word)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NACTIONS; ++i) {
|
for (int i = 0; i < NACTIONS; ++i) {
|
||||||
for (int j = 0; j < actions[i].words.n; ++j) {
|
for (int j = 0; j < actions[i].words.n; ++j) {
|
||||||
if (strcasecmp(word, actions[i].words.strs[j]) == 0 && (strlen(word) > 1 ||
|
if (strncasecmp(word, actions[i].words.strs[j], TOKLEN) == 0 && (strlen(word) > 1 ||
|
||||||
strchr(ignore, word[0]) == NULL ||
|
strchr(ignore, word[0]) == NULL ||
|
||||||
!settings.oldstyle))
|
!settings.oldstyle))
|
||||||
return (i);
|
return (i);
|
||||||
|
@ -505,7 +505,7 @@ int get_special_vocab_id(const char* word)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NSPECIALS; ++i) {
|
for (int i = 0; i < NSPECIALS; ++i) {
|
||||||
for (int j = 0; j < specials[i].words.n; ++j) {
|
for (int j = 0; j < specials[i].words.n; ++j) {
|
||||||
if (strcasecmp(word, specials[i].words.strs[j]) == 0)
|
if (strncasecmp(word, specials[i].words.strs[j], TOKLEN) == 0)
|
||||||
return (i);
|
return (i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue