From 8b1c6148f61c47d3629911258d4767f937cd4f32 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 16 Nov 2019 08:27:07 -0500 Subject: [PATCH 1/4] improve pluralization on some words ending with a k-sound fixes #245 --- doc/fixes36.3 | 1 + src/objnam.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 287b74044..d65976a9d 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -232,6 +232,7 @@ dipping into an undiscovered potion would offer chance to give a name to the potion even when its description wasn't known (picked up while blind) dipping lichen corpse into acid when not blind and acid was undicovered would not offer a chance to give a name to the potion after lichen feedback +pluralization improvement for words ending in a k-sound like "biotech" Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/objnam.c b/src/objnam.c index 765414417..ba301b9cf 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -2435,7 +2435,10 @@ const char *oldstr; /* Ends in z, x, s, ch, sh; add an "es" */ if (index("zxs", lo_c) - || (len >= 2 && lo_c == 'h' && index("cs", lowc(*(spot - 1)))) + || (len >= 2 && lo_c == 'h' && index("cs", lowc(*(spot - 1))) + /* 21st century k-sound */ + && !(len >= 4 && !strcmpi(spot - 2, "ech") + && index("tm", lowc(*(spot - 4))))) /* Kludge to get "tomatoes" and "potatoes" right */ || (len >= 4 && !strcmpi(spot - 2, "ato")) || (len >= 5 && !strcmpi(spot - 4, "dingo"))) { From 6a3dcc6a382f69fbd6fe990e163cc69ddb8ca95e Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 16 Nov 2019 10:08:21 -0500 Subject: [PATCH 2/4] more pluralization --- src/objnam.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/objnam.c b/src/objnam.c index ba301b9cf..3eea10d94 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -2205,6 +2205,11 @@ const char *const *alt_as_is; /* another set like as_is[] */ } } + /* Leave "craft" as a suffix as-is (aircraft, hovercraft); + "craft" itself is (arguably) not included in our likely context */ + if ((baselen > 5) && (!BSTRCMPI(basestr, endstring - 5, "craft"))) + return TRUE; + /* avoid false hit on one_off[].plur == "lice" or .sing == "goose"; if more of these turn up, one_off[] entries will need to flagged as to which are whole words and which are matchable as suffices @@ -2215,6 +2220,7 @@ const char *const *alt_as_is; /* another set like as_is[] */ Strcasecpy(endstring, "s"); return TRUE; } + /* skip "ox" -> "oxen" entry when pluralizing "ox" unless it is muskox */ if (to_plural && baselen > 2 && !strcmpi(endstring - 2, "ox") @@ -2435,10 +2441,7 @@ const char *oldstr; /* Ends in z, x, s, ch, sh; add an "es" */ if (index("zxs", lo_c) - || (len >= 2 && lo_c == 'h' && index("cs", lowc(*(spot - 1))) - /* 21st century k-sound */ - && !(len >= 4 && !strcmpi(spot - 2, "ech") - && index("tm", lowc(*(spot - 4))))) + || (len >= 2 && lo_c == 'h' && index("cs", lowc(*(spot - 1)))) /* Kludge to get "tomatoes" and "potatoes" right */ || (len >= 4 && !strcmpi(spot - 2, "ato")) || (len >= 5 && !strcmpi(spot - 4, "dingo"))) { From 340851ecf516371c501d43bcd8a3499a31d38538 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 16 Nov 2019 10:13:49 -0500 Subject: [PATCH 3/4] Revert "more pluralization" This reverts commit 6a3dcc6a382f69fbd6fe990e163cc69ddb8ca95e. --- src/objnam.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/objnam.c b/src/objnam.c index 3eea10d94..ba301b9cf 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -2205,11 +2205,6 @@ const char *const *alt_as_is; /* another set like as_is[] */ } } - /* Leave "craft" as a suffix as-is (aircraft, hovercraft); - "craft" itself is (arguably) not included in our likely context */ - if ((baselen > 5) && (!BSTRCMPI(basestr, endstring - 5, "craft"))) - return TRUE; - /* avoid false hit on one_off[].plur == "lice" or .sing == "goose"; if more of these turn up, one_off[] entries will need to flagged as to which are whole words and which are matchable as suffices @@ -2220,7 +2215,6 @@ const char *const *alt_as_is; /* another set like as_is[] */ Strcasecpy(endstring, "s"); return TRUE; } - /* skip "ox" -> "oxen" entry when pluralizing "ox" unless it is muskox */ if (to_plural && baselen > 2 && !strcmpi(endstring - 2, "ox") @@ -2441,7 +2435,10 @@ const char *oldstr; /* Ends in z, x, s, ch, sh; add an "es" */ if (index("zxs", lo_c) - || (len >= 2 && lo_c == 'h' && index("cs", lowc(*(spot - 1)))) + || (len >= 2 && lo_c == 'h' && index("cs", lowc(*(spot - 1))) + /* 21st century k-sound */ + && !(len >= 4 && !strcmpi(spot - 2, "ech") + && index("tm", lowc(*(spot - 4))))) /* Kludge to get "tomatoes" and "potatoes" right */ || (len >= 4 && !strcmpi(spot - 2, "ato")) || (len >= 5 && !strcmpi(spot - 4, "dingo"))) { From cdbad827fe5b187f4c6abdb9b5fafb355541a827 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 16 Nov 2019 10:15:55 -0500 Subject: [PATCH 4/4] reinstate bit - gak! --- src/objnam.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/objnam.c b/src/objnam.c index ba301b9cf..9cf7edda0 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -2205,7 +2205,11 @@ const char *const *alt_as_is; /* another set like as_is[] */ } } - /* avoid false hit on one_off[].plur == "lice" or .sing == "goose"; + /* Leave "craft" as a suffix as-is (aircraft, hovercraft); + "craft" itself is (arguably) not included in our likely context */ + if ((baselen > 5) && (!BSTRCMPI(basestr, endstring - 5, "craft"))) + return TRUE; + /* avoid false hit on one_off[].plur == "lice" or .sing == "goose"; if more of these turn up, one_off[] entries will need to flagged as to which are whole words and which are matchable as suffices then matching in the loop below will end up becoming more complex */