2019-02-05 02:44:07 +02:00
|
|
|
[LinguisticsModule::] Linguistics Module.
|
|
|
|
|
|
|
|
Setting up the use of this module.
|
|
|
|
|
2022-05-17 09:46:35 +03:00
|
|
|
@ This section simply sets up the module in ways expected by //foundation//, and
|
2020-03-28 17:00:33 +02:00
|
|
|
contains no code of interest. The following constant exists only in tools
|
|
|
|
which use this module:
|
2019-02-05 02:44:07 +02:00
|
|
|
|
|
|
|
@d LINGUISTICS_MODULE TRUE
|
|
|
|
|
2020-05-09 18:25:04 +03:00
|
|
|
@ This module defines the following classes:
|
2019-02-05 02:44:07 +02:00
|
|
|
|
2020-06-29 16:28:21 +03:00
|
|
|
@e adjective_CLASS
|
2020-07-01 02:58:55 +03:00
|
|
|
@e article_CLASS
|
2020-07-08 01:49:36 +03:00
|
|
|
@e article_usage_CLASS
|
2020-05-09 15:07:39 +03:00
|
|
|
@e quantifier_CLASS
|
|
|
|
@e determiner_CLASS
|
2020-06-30 01:41:10 +03:00
|
|
|
@e grammatical_category_CLASS
|
|
|
|
@e linguistic_stock_item_CLASS
|
2020-07-07 14:07:15 +03:00
|
|
|
@e grammatical_usage_CLASS
|
2020-06-29 22:08:47 +03:00
|
|
|
@e verb_CLASS
|
2020-05-09 15:07:39 +03:00
|
|
|
@e verb_form_CLASS
|
2020-05-09 16:15:42 +03:00
|
|
|
@e verb_meaning_CLASS
|
2020-05-09 15:07:39 +03:00
|
|
|
@e verb_sense_CLASS
|
|
|
|
@e verb_usage_CLASS
|
|
|
|
@e verb_usage_tier_CLASS
|
2020-06-30 01:41:10 +03:00
|
|
|
@e preposition_CLASS
|
2020-05-09 15:07:39 +03:00
|
|
|
@e noun_CLASS
|
2020-07-03 01:09:26 +03:00
|
|
|
@e noun_usage_CLASS
|
2020-07-01 02:58:55 +03:00
|
|
|
@e pronoun_CLASS
|
2020-07-07 14:07:15 +03:00
|
|
|
@e pronoun_usage_CLASS
|
2020-07-07 20:24:23 +03:00
|
|
|
@e small_word_set_CLASS
|
2020-07-26 18:09:24 +03:00
|
|
|
@e special_meaning_holder_CLASS
|
2020-07-18 17:25:38 +03:00
|
|
|
@e time_period_CLASS
|
2019-02-05 02:44:07 +02:00
|
|
|
|
|
|
|
=
|
2020-06-29 16:28:21 +03:00
|
|
|
DECLARE_CLASS(adjective)
|
2020-07-01 02:58:55 +03:00
|
|
|
DECLARE_CLASS(article)
|
2020-07-08 01:49:36 +03:00
|
|
|
DECLARE_CLASS(article_usage)
|
2020-05-09 15:07:39 +03:00
|
|
|
DECLARE_CLASS(quantifier)
|
|
|
|
DECLARE_CLASS(determiner)
|
2020-06-30 01:41:10 +03:00
|
|
|
DECLARE_CLASS(grammatical_category)
|
|
|
|
DECLARE_CLASS(linguistic_stock_item)
|
2020-07-07 14:07:15 +03:00
|
|
|
DECLARE_CLASS(grammatical_usage)
|
2020-06-29 22:08:47 +03:00
|
|
|
DECLARE_CLASS(verb)
|
2020-05-09 15:07:39 +03:00
|
|
|
DECLARE_CLASS(verb_form)
|
|
|
|
DECLARE_CLASS_ALLOCATED_IN_ARRAYS(verb_meaning, 100)
|
|
|
|
DECLARE_CLASS(verb_sense)
|
|
|
|
DECLARE_CLASS(verb_usage)
|
|
|
|
DECLARE_CLASS(verb_usage_tier)
|
2020-06-30 01:41:10 +03:00
|
|
|
DECLARE_CLASS(preposition)
|
2020-07-18 17:25:38 +03:00
|
|
|
DECLARE_CLASS(time_period)
|
2020-05-09 15:07:39 +03:00
|
|
|
DECLARE_CLASS(noun)
|
2020-07-03 01:09:26 +03:00
|
|
|
DECLARE_CLASS(noun_usage)
|
2020-07-01 02:58:55 +03:00
|
|
|
DECLARE_CLASS(pronoun)
|
2020-07-07 14:07:15 +03:00
|
|
|
DECLARE_CLASS(pronoun_usage)
|
2020-07-26 18:09:24 +03:00
|
|
|
DECLARE_CLASS(special_meaning_holder)
|
2020-07-07 20:24:23 +03:00
|
|
|
DECLARE_CLASS(small_word_set)
|
2019-02-05 02:44:07 +02:00
|
|
|
|
2020-03-28 17:00:33 +02:00
|
|
|
@ Like all modules, this one must define a |start| and |end| function:
|
2019-02-05 02:44:07 +02:00
|
|
|
|
2020-07-01 02:58:55 +03:00
|
|
|
@e LINGUISTIC_STOCK_DA
|
2020-05-27 01:02:00 +03:00
|
|
|
@e TIME_PERIODS_DA
|
|
|
|
@e VERB_USAGES_DA
|
|
|
|
@e VERB_FORMS_DA
|
|
|
|
|
2019-02-05 02:44:07 +02:00
|
|
|
=
|
2020-08-27 17:50:24 +03:00
|
|
|
COMPILE_WRITER(noun *, Nouns::log)
|
|
|
|
|
2019-02-05 02:44:07 +02:00
|
|
|
void LinguisticsModule::start(void) {
|
|
|
|
@<Register this module's debugging log aspects@>;
|
|
|
|
@<Register this module's debugging log writers@>;
|
2020-07-01 02:58:55 +03:00
|
|
|
@<Declare new memory allocation reasons@>;
|
2020-06-30 01:41:10 +03:00
|
|
|
Stock::create_categories();
|
2019-02-05 02:44:07 +02:00
|
|
|
Cardinals::enable_in_word_form();
|
|
|
|
Articles::mark_for_preform();
|
|
|
|
Prepositions::mark_for_preform();
|
2020-08-07 00:01:38 +03:00
|
|
|
Diagrams::declare_annotations();
|
2019-02-05 02:44:07 +02:00
|
|
|
}
|
2020-03-28 17:00:33 +02:00
|
|
|
void LinguisticsModule::end(void) {
|
|
|
|
}
|
|
|
|
|
2019-02-05 02:44:07 +02:00
|
|
|
@<Register this module's debugging log aspects@> =
|
2023-09-05 10:36:51 +03:00
|
|
|
Log::declare_aspect(LINGUISTIC_STOCK_DA, U"linguistic stock", FALSE, FALSE);
|
|
|
|
Log::declare_aspect(TIME_PERIODS_DA, U"time periods", FALSE, FALSE);
|
|
|
|
Log::declare_aspect(VERB_USAGES_DA, U"verb usages", FALSE, TRUE);
|
|
|
|
Log::declare_aspect(VERB_FORMS_DA, U"verb forms", FALSE, TRUE);
|
2019-02-05 02:44:07 +02:00
|
|
|
|
|
|
|
@<Register this module's debugging log writers@> =
|
|
|
|
Writers::register_logger('t', Occurrence::log);
|
|
|
|
Writers::register_logger('p', Prepositions::log);
|
|
|
|
Writers::register_logger('w', Verbs::log_verb);
|
|
|
|
Writers::register_logger('y', VerbMeanings::log);
|
2020-08-27 17:50:24 +03:00
|
|
|
REGISTER_WRITER('z', Nouns::log);
|
2019-02-05 02:44:07 +02:00
|
|
|
|
2020-07-01 02:58:55 +03:00
|
|
|
@ Not all of our memory will be claimed in the form of structures: now and then
|
|
|
|
we need to use the equivalent of traditional |malloc| and |calloc| routines.
|
|
|
|
|
|
|
|
@e STOCK_MREASON
|
2020-07-07 20:24:23 +03:00
|
|
|
@e SWS_MREASON
|
2020-07-01 02:58:55 +03:00
|
|
|
|
|
|
|
@<Declare new memory allocation reasons@> =
|
|
|
|
Memory::reason_name(STOCK_MREASON, "linguistic stock array");
|
2020-07-07 20:24:23 +03:00
|
|
|
Memory::reason_name(SWS_MREASON, "small word set array");
|
2020-07-01 02:58:55 +03:00
|
|
|
|
2020-05-30 16:33:19 +03:00
|
|
|
@ This module requires //words//, which contains the Preform parser. When that
|
2020-03-28 17:00:33 +02:00
|
|
|
initialises, it calls the following routine to improve its performance.
|
|
|
|
|
2020-05-19 18:36:50 +03:00
|
|
|
@d PREFORM_OPTIMISER_WORDS_CALLBACK LinguisticsModule::preform_optimiser
|
2020-05-18 20:10:17 +03:00
|
|
|
|
2020-03-28 17:00:33 +02:00
|
|
|
=
|
2020-05-19 13:46:13 +03:00
|
|
|
int first_round_of_nt_optimisation_made = FALSE;
|
2019-02-05 02:44:07 +02:00
|
|
|
void LinguisticsModule::preform_optimiser(void) {
|
|
|
|
Cardinals::preform_optimiser();
|
|
|
|
VerbUsages::preform_optimiser();
|
|
|
|
Prepositions::preform_optimiser();
|
2020-05-19 13:46:13 +03:00
|
|
|
if (first_round_of_nt_optimisation_made == FALSE) {
|
|
|
|
first_round_of_nt_optimisation_made = TRUE;
|
|
|
|
Quantifiers::make_built_in();
|
|
|
|
}
|
2019-02-05 02:44:07 +02:00
|
|
|
}
|