Tune up Abbreviations.cpp to silence some warnings

This commit is contained in:
twistdroach
2024-06-19 19:03:52 -04:00
parent 3080705025
commit 8048c7db38

@ -6,8 +6,9 @@
#include "HashTableX.h"
#include "Threads.h"
class Abbr {
public:
#include <array>
struct Abbr {
char *m_str;
// MUST it have a word after it????
bool m_hasWordAfter;
@ -15,214 +16,207 @@ public:
// . i shrunk this list a lot
// . see backups for the hold list
static class Abbr s_abbrs99[] = {
{"hghway",0},//highway
{"hway",0},//highway
{"hwy",0},//highway
{"ln",0}, // lane
{"mil",0}, // military
{"pkway",0}, // parkway
{"pkwy",0}, // parkway
{"lp",0}, // Loop
{"phd",0}, // Loop
{"demon",0}, // demonstration
{"alz",0}, // alzheimer's
static const std::array<Abbr, 190> s_abbrs99 = {{
{"hghway",false},//highway
{"hway",false},//highway
{"hwy",false},//highway
{"ln",false}, // lane
{"mil",false}, // military
{"pkway",false}, // parkway
{"pkwy",false}, // parkway
{"lp",false}, // Loop
{"phd",false}, // Loop
{"demon",false}, // demonstration
{"alz",false}, // alzheimer's
{"lang",0}, // language
{"gr",0}, // grade(s) "xmas concert gr. 1-5"
{"vars",0}, // varsity
{"avg",0}, // average
{"amer",0}, // america
{"lang",false}, // language
{"gr",false}, // grade(s) "xmas concert gr. 1-5"
{"vars",false}, // varsity
{"avg",false}, // average
{"amer",false}, // america
{"bet",0}, // between 18th and 19th for piratecatradio.com
{"nr",0}, // near 6th street = nr. 6th street
{"appt",0},
{"tel",1},
{"intl",0},
{"div",1}, // div. II
{"bet",false}, // between 18th and 19th for piratecatradio.com
{"nr",false}, // near 6th street = nr. 6th street
{"appt",false},
{"tel",true},
{"intl",false},
{"div",true}, // div. II
{"int",1}, // Intermediate Dance
{"beg",1}, // Beginner Dance
{"adv",1}, // Advanced Dance
{"int",true}, // Intermediate Dance
{"beg",true}, // Beginner Dance
{"adv",true}, // Advanced Dance
{"feat",1}, // featuring.
{"tdlr",0}, // toddler
{"schl",0}, // pre-schl
{"feat",true}, // featuring.
{"tdlr",false}, // toddler
{"schl",false}, // pre-schl
// times
{"am",0}, // unm.edu url puts {"7 am. - 9 am.{" time ranges!
{"pm",0},
{"mon",0},
{"tue",0},
{"tues",0},
{"wed",0},
{"wednes",0},
{"thu",0},
{"thur",0},
{"thurs",0},
{"fri",0},
{"sat",0},
{"sun",0},
{"am",false}, // unm.edu url puts {"7 am. - 9 am.{" time ranges!
{"pm",false},
{"mon",false},
{"tue",false},
{"tues",false},
{"wed",false},
{"wednes",false},
{"thu",false},
{"thur",false},
{"thurs",false},
{"fri",false},
{"sat",false},
{"sun",false},
{"Ala",0},
{"Ariz",0},
{"Assn",0},
{"Assoc",0},
{"asst",0}, // assistant
{"Atty",0},
{"Attn",1},
{"Aug",0},
{"Ave",0},
{"Bldg",0},
{"Bros",0}, // brothers
{"Blvd",0},
{"Calif",0},
{"Capt",1},
{"Cf",0},
{"Ch",0},
{"Co",0},
{"Col",0},
{"Colo",0},
{"Conn",0},
{"Mfg",0},
{"Corp",0},
{"DR",0},
{"Dec",0},
{"Dept",0},
{"Dist",0},
{"Dr",0},
{"Drs",0},
{"Ed",0},
{"Eq",0},
{"ext",0}, // extension
{"FEB",0},
{"Feb",0},
{"Fig",0},
{"Figs",0},
{"Fla",0},
{"Ft",1}, // ft. worth texas or feet
{"Ga",0},
{"Gen",0},
{"Gov",0},
{"HON",0},
{"Ill",0},
{"Inc",0},
{"JR",0},
{"Jan",0},
{"Jr",0},
{"Kan",0},
//{"Ky",0},
{"La",0},
{"Lt",0},
{"Ltd",0},
{"MR",1},
{"MRS",1},
{"Mar",0},
{"Mass",0},
{"Md",0},
{"Messrs",1},
{"Mich",0},
{"Minn",0},
{"Miss",0},
{"Mmes",0},
//{"Mo",0}, no more 2-letter state abbreviations
{"Mr",1},
{"Mrs",1},
{"Ms",1},
{"Msgr",1},
{"Mt",1},
{"NO",0},
{"No",0},
{"Nov",0},
{"Oct",0},
{"Okla",0},
{"Op",0},
{"Ore",0},
//{"Pa",0},
{"Pp",0},
{"Prof",1},
{"Prop",0},
{"Rd",0},
{"Ref",0},
{"Rep",0},
{"Reps",0},
{"Rev",0},
{"Rte",0},
{"Sen",0},
{"Sept",0},
{"Sr",0},
{"St",0},
{"ste",0},
{"Stat",0},
{"Supt",0},
{"Tech",0},
{"Tex",0},
{"Va",0},
{"Vol",0},
{"Wash",0},
//{"al",0},
{"av",0},
{"ave",0},
{"ca",0},
{"cc",0},
{"chap",0},
{"cm",0},
{"cu",0},
{"dia",0},
{"dr",0},
{"eqn",0},
{"etc",0},
{"fig",1},
{"figs",1},
{"ft",0}, // fort or feet or featuring
//{"gm",0},
{"hr",0},
//{"in",0},
//{"kc",0},
{"lb",0},
{"lbs",0},
{"mg",0},
{"ml",0},
{"mm",0},
{"mv",0},
//{"nw",0},
{"oz",0},
{"pl",0},
{"pp",0},
{"sec",0},
{"sq",0},
{"st",0},
{"vs",1},
{"yr",0},
{"yrs",0}, // 3 yrs old
{"Ala",false},
{"Ariz",false},
{"Assn",false},
{"Assoc",false},
{"asst",false}, // assistant
{"Atty",false},
{"Attn",true},
{"Aug",false},
{"Ave",false},
{"Bldg",false},
{"Bros",false}, // brothers
{"Blvd",false},
{"Calif",false},
{"Capt",true},
{"Cf",false},
{"Ch",false},
{"Co",false},
{"Col",false},
{"Colo",false},
{"Conn",false},
{"Mfg",false},
{"Corp",false},
{"DR",false},
{"Dec",false},
{"Dept",false},
{"Dist",false},
{"Dr",false},
{"Drs",false},
{"Ed",false},
{"Eq",false},
{"ext",false}, // extension
{"FEB",false},
{"Feb",false},
{"Fig",false},
{"Figs",false},
{"Fla",false},
{"Ft",true}, // ft. worth texas or feet
{"Ga",false},
{"Gen",false},
{"Gov",false},
{"HON",false},
{"Ill",false},
{"Inc",false},
{"JR",false},
{"Jan",false},
{"Jr",false},
{"Kan",false},
{"La",false},
{"Lt",false},
{"Ltd",false},
{"MR",true},
{"MRS",true},
{"Mar",false},
{"Mass",false},
{"Md",false},
{"Messrs",true},
{"Mich",false},
{"Minn",false},
{"Miss",false},
{"Mmes",false},
//{"Mo",false}, no more 2-letter state abbreviations
{"Mr",true},
{"Mrs",true},
{"Ms",true},
{"Msgr",true},
{"Mt",true},
{"NO",false},
{"No",false},
{"Nov",false},
{"Oct",false},
{"Okla",false},
{"Op",false},
{"Ore",false},
{"Pp",false},
{"Prof",true},
{"Prop",false},
{"Rd",false},
{"Ref",false},
{"Rep",false},
{"Reps",false},
{"Rev",false},
{"Rte",false},
{"Sen",false},
{"Sept",false},
{"Sr",false},
{"St",false},
{"ste",false},
{"Stat",false},
{"Supt",false},
{"Tech",false},
{"Tex",false},
{"Va",false},
{"Vol",false},
{"Wash",false},
{"av",false},
{"ave",false},
{"ca",false},
{"cc",false},
{"chap",false},
{"cm",false},
{"cu",false},
{"dia",false},
{"dr",false},
{"eqn",false},
{"etc",false},
{"fig",true},
{"figs",true},
{"ft",false}, // fort or feet or featuring
{"hr",false},
{"lb",false},
{"lbs",false},
{"mg",false},
{"ml",false},
{"mm",false},
{"mv",false},
{"oz",false},
{"pl",false},
{"pp",false},
{"sec",false},
{"sq",false},
{"st",false},
{"vs",true},
{"yr",false},
{"yrs",false}, // 3 yrs old
// middle initials
{"a",0},
{"b",0},
{"c",0},
{"d",0},
{"e",0},
{"f",0},
{"g",0},
{"h",0},
{"i",0},
{"j",0},
{"k",0},
{"l",0},
{"m",0},
{"n",0},
{"o",0},
{"p",0},
{"q",0},
{"r",0},
{"s",0},
{"t",0},
{"u",0},
{"v",1}, // versus
{"w",0},
{"x",0},
{"y",0},
{"z",0}
};
{"a",false},
{"b",false},
{"c",false},
{"d",false},
{"e",false},
{"f",false},
{"g",false},
{"h",false},
{"i",false},
{"j",false},
{"k",false},
{"l",false},
{"m",false},
{"n",false},
{"o",false},
{"p",false},
{"q",false},
{"r",false},
{"s",false},
{"t",false},
{"u",false},
{"v",true}, // versus
{"w",false},
{"x",false},
{"y",false},
{"z",false}
}};
static HashTableX s_abbrTable;
static bool s_abbrInitialized = false;
@ -234,12 +228,12 @@ bool isAbbr ( int64_t h , bool *hasWordAfter ) {
HashTableX *t = &s_abbrTable;
// set up the hash table
int32_t n = ((int32_t)sizeof(s_abbrs99))/ ((int32_t)sizeof(Abbr));
if ( ! t->set ( 8,4,n*4, NULL,0,false,MAX_NICENESS,"abbrtbl"))
if ( ! t->set ( 8,4,n*4, nullptr,0,false,MAX_NICENESS,"abbrtbl"))
return log("build: Could not init abbrev table.");
// now add in all the stop words
for ( int32_t i = 0 ; i < n ; i++ ) {
char *sw = s_abbrs99[i].m_str;
int64_t swh = hash64Lower_utf8 ( sw );
const char *sw = s_abbrs99[i].m_str;
int64_t swh = hash64Lower_utf8 ( sw );
int32_t val = i + 1;
gbassert( t->addKey (&swh,&val) );
}