6 from morphology.lemma
import Lemma
7 from morphology.related_form
import RelatedForm
8 from morphology.word_form
import WordForm
9 from common.range
import partOfSpeech_range
10 from config.mdf
import ps_partOfSpeech
11 from utils.attr
import check_attr_type, check_attr_range
12 from core.sense
import Sense
13 from morphology.list_of_components
import ListOfComponents
16 """! "Lexical Entry is a class representing a lexeme in a given language and is a container for managing the Form and Sense classes. A Lexical Entry instance can contain one to many different forms and can have from zero to many different senses." (LMF)
19 """! @brief Constructor.
20 LexicalEntry instances are owned by Lexicon.
21 @param id Unique IDentifier. If not provided, default value is 0.
22 @return A LexicalEntry instance.
57 """! @brief Destructor.
58 Release Sense, Lemma, RelatedForm, WordForm, Stem, ListOfComponents instances.
60 for sense
in self.
sense:
69 for stem
in self.
stem:
72 if self.
lemma is not None:
79 def set_partOfSpeech(self, part_of_speech, range=partOfSpeech_range, mapping=ps_partOfSpeech):
80 """! @brief Set grammatical category.
81 @param part_of_speech The grammatical category to set.
82 @param range A Python set giving all possible values of part of speech LMF attribute.
83 @param mapping A Python dictionary giving the mapping between MDF and LMF values.
84 @return LexicalEntry instance.
86 error_msg =
"Part of speech value '%s' encountered for lexeme '%s' is not allowed" % (part_of_speech.encode(
'utf8'), self.
get_lexeme().encode(
'utf8'))
90 value =
check_attr_range(part_of_speech.encode(
'utf8'), range, error_msg, mapping)
95 """! @brief Get grammatical category.
96 @return LexicalEntry attribute 'partOfSpeech'.
101 """! @brief Set lexical entry status.
102 @param status The status to set.
103 @return LexicalEntry instance.
109 """! @brief Get lexical entry status.
110 @return LexicalEntry attribute 'status'.
115 """! @brief Set lexical entry date.
116 @param status The date to set.
117 @return LexicalEntry instance.
123 """! @brief Get lexical entry date.
124 @return LexicalEntry attribute 'date'.
129 """! @brief Set lexical entry homonym number.
130 @param homonym_number The homonym number to set.
131 @return LexicalEntry instance.
137 """! @brief Get lexical entry homonym number.
138 @return LexicalEntry attribute 'homonymNumber'.
143 """! @brief Set lexical entry bibliography.
144 @param bibliography The bibliography to set.
145 @return LexicalEntry instance.
151 """! @brief Get lexical entry bibliography.
152 @return LexicalEntry attribute 'bibliography'.
157 """! @brief Set lexical entry independent word indication.
158 @param independent_word The independent word indication to set.
159 @return LexicalEntry instance.
161 error_msg =
"Independent word '%s' encountered for lexeme '%s' is not allowed" % (str(independent_word), self.
get_lexeme())
167 """! @brief Get lexical entry independent word indication.
168 @return LexicalEntry attribute 'independentWord'.
173 """! @brief Get Unique IDentifier.
174 @return LexicalEntry attribute 'id' followed by the homonym number.
177 if homonymNumber
is None:
179 return self.
id + str(homonymNumber)
182 """! @brief Set lexeme.
183 Attribute 'lexeme' is owned by Lemma.
184 @param lexeme The lexeme to set.
185 @return LexicalEntry instance.
188 if self.
lemma is None:
190 self.lemma.set_lexeme(lexeme)
194 """! @brief Get lexeme.
195 Attribute 'lexeme' is owned by Lemma.
196 @return Lemma attribute 'lexeme' if any.
198 if self.
lemma is not None:
199 return self.lemma.get_lexeme()
202 """! @brief Create a related form.
203 @param lexeme Related lexeme.
204 @param semantic_relation The semantic relation existing between this lexical entry and the related lexeme to create.
205 @return RelatedForm instance.
207 return RelatedForm(lexeme).set_semanticRelation(semantic_relation)
210 """! @brief Add a related form to the lexical entry.
211 @param related_form The RelatedForm instance to add to the lexical entry.
212 @return LexicalEntry instance.
214 self.related_form.append(related_form)
218 """! @brief Create and add a related form to the lexical entry.
219 @param lexeme Related lexeme.
220 @param semantic_relation The semantic relation existing between this lexical entry and the related lexeme to create.
221 @return LexicalEntry instance.
225 if related_form.get_lexeme() == lexeme:
227 self.related_form.append(RelatedForm(lexeme).set_semanticRelation(semantic_relation))
231 """! @brief Find related lexemes.
232 This attribute is owned by RelatedForm.
233 @param semantic_relation The semantic relation to consider to retrieve the related form.
234 @return A Python list of found RelatedForm attributes 'targets'.
238 if related_form.get_semanticRelation() == semantic_relation:
239 found_lexemes.append(related_form.get_lexeme())
243 """! @brief Get all related forms maintained by the lexical entry.
244 @param semantic_relation The semantic relation to consider to retrieve the related forms.
245 @return A Python set of related forms.
247 if semantic_relation
is None:
251 if related_form.get_semanticRelation() == semantic_relation:
252 found_forms.append(related_form)
256 """! @brief Get the previously registered related form.
257 @param semantic_relation The semantic relation to consider to retrieve the last related form.
258 @return The last element of LexicalEntry attribute 'related_form' that matches with semantic relation if provided.
264 """! @brief Get all form representations maintained by the lemma.
265 Attribute 'form_representation' is owned by Lemma.
266 @return Lemma attribute 'form_representation' if any.
268 if self.
lemma is not None:
269 return self.lemma.get_form_representations()
272 """! @brief Set variant form and type.
273 Attributes 'variantForm' and 'type' are owned by FormRepresentation, which is owned by Lemma.
274 @param variant_form Variant form.
275 @param type Type of variant, in range 'type_variant_range' defined in 'common/range.py'.
276 @return LexicalEntry instance.
279 if self.
lemma is None:
281 self.lemma.set_variant_form(variant_form, type)
285 """! @brief Get all variant forms of specified type.
286 Attribute 'variantForm' is owned by FormRepresentation, which is owned by Lemma.
287 @return A Python list of FormRepresentation attributes 'variantForm' if type matches.
289 if self.
lemma is not None:
290 return self.lemma.get_variant_forms(type)
293 """! @brief Set variant comment and language.
294 Attributes 'comment' and 'language' are owned by FormRepresentation, which is owned by Lemma.
295 @param comment Variant comment.
296 @param language Language of comment.
297 @return LexicalEntry instance.
300 if self.
lemma is None:
302 self.lemma.set_variant_comment(comment, language)
306 """! @brief Set tone.
307 Attribute 'tone' is owned by FormRepresentation, which is owned by Lemma.
308 @param tone The tone to set.
309 @return LexicalEntry instance.
312 if self.
lemma is None:
314 self.lemma.set_tone(tone)
318 """! @brief Get all tones.
319 Attribute 'tone' is owned by FormRepresentation, which is owned by Lemma.
320 @return A Python list of FormRepresentation attributes 'tone' if any.
322 if self.
lemma is not None:
323 return self.lemma.get_tones()
326 """! @brief Set geographical variant.
327 Attribute 'geographicalVariant' is owned by FormRepresentation, which is owned by Lemma.
328 @param geographical_variant The geographical variant to set.
329 @return LexicalEntry instance.
332 if self.
lemma is None:
334 self.lemma.set_geographical_variant(geographical_variant)
338 """! @brief Set phonetic form.
339 Attribute 'phoneticForm' is owned by FormRepresentation, which is owned by Lemma.
340 @param phonetic_form The phonetic form to set.
341 @param script_name The name of the script used to write the phonetic form, e.g. pinyin.
342 @return LexicalEntry instance.
345 if self.
lemma is None:
347 self.lemma.set_phonetic_form(phonetic_form, script_name)
351 """! @brief Get all phonetic forms.
352 Attribute 'phoneticForm' is owned by FormRepresentation, which is owned by Lemma.
353 @param script_name If provided, get only phonetic forms that are written using this script.
354 @return A Python list of FormRepresentation attributes 'phoneticForm' if any.
356 if self.
lemma is not None:
357 return self.lemma.get_phonetic_forms(script_name)
360 """! @brief Set contextual variation.
361 Attribute 'contextualVariation' is owned by FormRepresentation, which is owned by Lemma.
362 @param contextual_variation The contextual variation to set.
363 @return LexicalEntry instance.
366 if self.
lemma is None:
368 self.lemma.set_contextual_variation(contextual_variation)
372 """! @brief Get all contextual variations.
373 Attribute 'contextualVariation' is owned by FormRepresentation, which is owned by Lemma.
374 @return A Python list of FormRepresentation attributes 'contextualVariation' if any.
376 if self.
lemma is not None:
377 return self.lemma.get_contextual_variations()
380 """! @brief Set spelling variant.
381 Attribute 'spellingVariant' is owned by FormRepresentation, which is owned by Lemma.
382 @param spelling_variant The spelling variant to set.
383 @return LexicalEntry instance.
386 if self.
lemma is None:
388 self.lemma.set_spelling_variant(spelling_variant)
392 """! @brief Get all spelling variants.
393 Attribute 'spellingVariant' is owned by FormRepresentation, which is owned by Lemma.
394 @return A Python list of FormRepresentation attributes 'spellingVariant' if any.
396 if self.
lemma is not None:
397 return self.lemma.get_spelling_variants()
400 """! @brief Set citation form.
401 Attribute 'citationForm' is owned by FormRepresentation, which is owned by Lemma.
402 @param citation_form The citation form to set.
403 @param script_name The name of the script used to write the citation form, e.g. devanagari.
404 @return LexicalEntry instance.
407 if self.
lemma is None:
409 self.lemma.set_citation_form(citation_form, script_name)
413 """! @brief Get all citation forms.
414 Attribute 'citationForm' is owned by FormRepresentation, which is owned by Lemma.
415 @param script_name If provided, get only citation forms that are written using this script.
416 @return A Python list of FormRepresentation attributes 'citationForm' if any.
418 if self.
lemma is not None:
419 return self.lemma.get_citation_forms(script_name)
422 """! @brief Set dialect.
423 Attribute 'dialect' is owned by FormRepresentation, which is owned by Lemma.
424 @param dialect The dialect to set.
425 @return LexicalEntry instance.
428 if self.
lemma is None:
430 self.lemma.set_dialect(dialect)
434 """! @brief Set transliteration.
435 Attribute 'transliteration' is owned by FormRepresentation, which is owned by Lemma.
436 @param transliteration The transliteration to set.
437 @return LexicalEntry instance.
440 if self.
lemma is None:
442 self.lemma.set_transliteration(transliteration)
446 """! @brief Get all transliterations.
447 Attribute 'transliteration' is owned by FormRepresentation, which is owned by Lemma.
448 @return A Python list of FormRepresentation attributes 'transliteration' if any.
450 if self.
lemma is not None:
451 return self.lemma.get_transliterations()
454 """! @brief Set script name.
455 Attribute 'scriptName' is owned by FormRepresentation, which is owned by Lemma.
456 @param script_name The script name to set.
457 @return LexicalEntry instance.
460 if self.
lemma is None:
462 self.lemma.set_script_name(script_name)
466 """! @brief Create a sense.
467 @param id Identifier.
468 @return Sense instance.
473 """! @brief Add a sense to the lexical entry.
474 @param sense The Sense instance to add to the lexical entry.
475 @return LexicalEntry instance.
477 self.sense.append(sense)
481 """! @brief Create and add a sense to the lexical entry.
482 @param sense_number Number of the sense to add.
483 @return LexicalEntry instance.
485 id = self.
get_id() +
"_" + str(sense_number)
490 """! @brief Get all senses maintained by the lexical entry.
491 @return LexicalEntry attribute 'sense'.
496 """! @brief Get the previously registered sense.
497 @return The last element of LexicalEntry attribute 'sense'.
503 """! @brief Set definition and language.
504 Attributes 'definition' and 'language' are owned by Definition, which is owned by Sense.
505 @param definition Definition.
506 @param language Language of definition.
507 @return LexicalEntry instance.
515 sense.set_definition(definition, language)
519 """! @brief Set gloss and language.
520 Attributes 'gloss' and 'language' are owned by Definition, which is owned by Sense.
522 @param language Language of gloss.
523 @return LexicalEntry instance.
531 sense.set_gloss(gloss, language)
534 def set_note(self, note, type=None, language=None):
535 """! @brief Set note, type and language.
536 Attributes 'note', 'noteType' and 'language' are owned by Statement, which owned by Definition, itself owned by Sense.
537 @param note Note to set.
538 @param type Type of the note.
539 @param language Language of the note.
540 @return LexicalEntry instance.
548 sense.set_note(note, type, language)
552 """! @brief Find notes.
553 This attribute is owned by Statement, which owned by Definition, itself owned by Sense.
554 @param type Type of the note to consider to retrieve the note.
555 @param language If this argument is given, find note only if written in this language.
556 @return A Python list of found Statement attributes 'notes'.
560 found_notes += sense.find_notes(type, language)
564 """! @brief Set usage note and language.
565 Attributes 'usageNote' and 'language' are owned by Statement, which owned by Definition, itself owned by Sense.
566 @param usage_note Usage note to set.
567 @param language Language of the usage note.
568 @return LexicalEntry instance.
576 sense.set_usage_note(usage_note, language)
580 """! @brief Set encyclopedic information and language.
581 Attributes 'encyclopedicInformation' and 'language' are owned by Statement, which owned by Definition, itself owned by Sense.
582 @param encyclopedic_information Encyclopedic information to set.
583 @param language Language of the encyclopedic information.
584 @return LexicalEntry instance.
592 sense.set_encyclopedic_information(encyclopedic_information, language)
596 """! @brief Set restriction and language.
597 Attributes 'restriction' and 'language' are owned by Statement, which owned by Definition, itself owned by Sense.
598 @param restriction Restriction to set.
599 @param language Language of the restriction.
600 @return LexicalEntry instance.
608 sense.set_restriction(restriction, language)
612 """! @brief Set source language (in English).
613 Attribute 'borrowedWord' is owned by Statement, which is owned by Definition, itself owned by Sense.
614 @param borrowed_word Source language.
615 @return LexicalEntry instance.
623 sense.set_borrowed_word(borrowed_word)
627 """! @brief Get source language (in English).
628 This attribute is owned by Statement, which is owned by Definition, itself owned by Sense.
629 @return Statement attribute 'borrowedWord'.
634 if sense
is not None:
635 return sense.get_borrowed_word()
638 """! @brief Set loan word.
639 Attribute 'writtenForm' is owned by Statement, which is owned by Definition, itself owned by Sense.
640 @param written_form Loan word.
641 @return LexicalEntry instance.
649 sense.set_written_form(written_form)
653 """! @brief Get loan word.
654 This attribute is owned by Statement, which is owned by Definition, itself owned by Sense.
655 @return Statement attribute 'writtenForm'.
660 if sense
is not None:
661 return sense.get_written_form()
664 """! @brief Set etymology.
665 Attribute 'etymology' is owned by Statement, which is owned by Definition, itself owned by Sense.
666 @param etymology Etymology.
667 @return LexicalEntry instance.
675 sense.set_etymology(etymology)
679 """! @brief Get etymology.
680 This attribute is owned by Statement, which is owned by Definition, itself owned by Sense.
681 @return The first found Statement attribute 'etymology'.
684 if sense.get_etymology()
is not None:
685 return sense.get_etymology()
688 """! @brief Set etymology comment and language.
689 Attributes 'etymologyComment' and 'termSourceLanguage' are owned by Statement, which is owned by Definition, itself owned by Sense.
690 @param etymology_comment Etymology comment.
691 @param term_source_language Language of the comment.
692 @return LexicalEntry instance.
700 sense.set_etymology_comment(etymology_comment, term_source_language)
704 """! @brief Get etymology comment.
705 This attribute is owned by Statement, which is owned by Definition, itself owned by Sense.
706 @param term_source_language The language of the etymology comment to retrieve.
707 @return The first found Statement attribute 'etymologyComment'.
710 if sense.get_etymology_comment(term_source_language)
is not None:
711 return sense.get_etymology_comment(term_source_language)
714 """! @brief Get language used for the etymology comment.
715 This attribute is owned by Statement, which is owned by Definition, itself owned by Sense.
716 @return Statement attribute 'termSourceLanguage'.
721 if sense
is not None:
722 return sense.get_term_source_language()
725 """! @brief Set etymology gloss.
726 Attribute 'etymologyGloss' is owned by Statement, which is owned by Definition, itself owned by Sense.
727 @param etymology_gloss Etymology gloss.
728 @return LexicalEntry instance.
736 sense.set_etymology_gloss(etymology_gloss)
740 """! @brief Get etymology gloss.
741 This attribute is owned by Statement, which is owned by Definition, itself owned by Sense.
742 @return Statement attribute 'etymologyGloss'.
747 if sense
is not None:
748 return sense.get_etymology_gloss()
751 """! @brief Set etymology source.
752 Attribute 'etymologySource' is owned by Statement, which is owned by Definition, itself owned by Sense.
753 @param etymology_source Etymology source.
754 @return LexicalEntry instance.
762 sense.set_etymology_source(etymology_source)
766 """! @brief Get etymology source.
767 This attribute is owned by Statement, which is owned by Definition, itself owned by Sense.
768 @return Statement attribute 'etymologySource'.
773 if sense
is not None:
774 return sense.get_etymology_source()
777 """! @brief Set scientific_name.
778 Attribute 'scientificName' is owned by Statement, which is owned by Definition, itself owned by Sense.
779 @param scientific_name Scientific name.
780 @return LexicalEntry instance.
788 sense.set_scientific_name(scientific_name)
792 """! @brief Get scientific name.
793 This attribute is owned by Statement, which is owned by Definition, itself owned by Sense.
794 @return Statement attribute 'scientificName'.
799 if sense
is not None:
800 return sense.get_scientific_name()
803 """! @brief Create a word form.
804 @return WordForm instance.
809 """! @brief Add a word form to the lexical entry.
810 @param word_form The WordForm instance to add to the lexical entry.
811 @return LexicalEntry instance.
813 self.word_form.append(word_form)
817 """! @brief Get all word forms maintained by the lexical entry.
818 @return A Python list of word forms.
822 def set_paradigm(self, written_form, script_name=None, person=None, anymacy=None, grammatical_number=None, clusivity=None):
823 """! @brief Set paradigm.
824 Attributes 'writtenForm' and 'scriptName' are owned by FormRepresentation, wich is owned by WordForm.
825 Attributes 'person', 'anymacy', 'grammaticalNumber' and 'clusivity' are owned by WordForm.
826 @param written_form The paradigm to set.
827 @param script_name Script used for the written form.
828 @param person Person, e.g. first person.
829 @param anymacy Anymacy, e.g. animate or inanimate.
830 @param grammatical_number Grammatical number, e.g. singular or plural.
831 @param clusivity Clusivity, e.g. inclusive or exclusive.
832 @return LexicalEntry instance.
837 if form.get_person() == person
and form.get_anymacy() == anymacy
and form.get_grammaticalNumber() == grammatical_number
and form.get_clusivity() == clusivity:
841 if word_form
is None:
845 if person
is not None:
846 word_form.set_person(person)
847 if anymacy
is not None:
848 word_form.set_anymacy(anymacy)
849 if grammatical_number
is not None:
850 word_form.set_grammaticalNumber(grammatical_number)
851 if clusivity
is not None:
852 word_form.set_clusivity(clusivity)
853 word_form.set_written_form(written_form, script_name)
856 def find_paradigms(self, script_name=None, person=None, anymacy=None, grammatical_number=None, clusivity=None):
857 """! @brief Find paradigms.
858 Attribute 'scriptName' is owned by FormRepresentation, wich is owned by WordForm.
859 Attributes 'person', 'anymacy', 'grammaticalNumber' and 'clusivity' are owned by WordForm.
860 Attribute 'writtenForm' to retrieve is owned by FormRepresentation, wich is owned by WordForm.
861 @param script_name If this argument is given, get paradigm written form only if written using this script.
862 @param person Person, e.g. first person.
863 @param anymacy Anymacy, e.g. animate or inanimate.
864 @param grammatical_number Grammatical number, e.g. singular or plural.
865 @param clusivity Clusivity, e.g. inclusive or exclusive.
866 @return A Python list of FormRepresentation attributes 'writtenForm'.
871 if form.get_person() == person
and form.get_anymacy() == anymacy
and form.get_grammaticalNumber() == grammatical_number
and form.get_clusivity() == clusivity:
872 written_forms += form.get_written_forms(script_name)
876 """! @brief Set paradigm label.
877 Attribute 'paradigmLabel' is owned by Paradigm, which is owned by Sense.
878 @param paradigm_label Paradigm label.
879 @return LexicalEntry instance.
887 sense.set_paradigm_label(paradigm_label)
891 """! @brief Set paradigm form.
892 Attribute 'paradigm' is owned by Paradigm, which is owned by Sense.
893 @param paradigm Paradigm form.
894 @param language Language of the paradigm form.
895 @return LexicalEntry instance.
903 sense.set_paradigm_form(paradigm, language)
907 """! @brief Set morphology.
908 Attribute 'morphology' is owned by Paradigm, which is owned by Sense.
909 @param morphology Morphology.
910 @return LexicalEntry instance.
918 sense.set_morphology(morphology)
922 """! @brief Get all paradigms.
923 This attribute is owned by Sense.
924 @return Sense attribute 'paradigm'.
928 paradigms += sense.get_paradigms()
932 """! @brief Get all morphologies.
933 This attribute is owned by Paradigm, which is owned by Sense.
934 @return A Python list of Paradigm attributes 'morphology'.
938 for paradigm
in sense.get_paradigms():
939 if paradigm.get_morphology()
is not None:
940 morphologies.append(paradigm.get_morphology())
944 """! @brief Create a context.
945 Attribute 'targets' is owned by Context, itself owend by Sense.
946 @param reference The example reference to set. If not provided, default value is None.
947 @return LexicalEntry instance.
955 sense.create_example(reference)
959 """! @brief Add an example to a new context and set its written form, language and script.
960 Attributes 'writtenForm', 'language' and 'scriptName' are owned by TextRepresentation, which is owned by Context, itself owend by Sense.
961 @param written_form The written form to set.
962 @param language Language used for the written form.
963 @param script_name The name of the script used to write the example, e.g. devanagari.
964 @return LexicalEntry instance.
972 sense.create_and_add_example(written_form, language, script_name)
975 def add_example(self, written_form, language=None, script_name=None):
976 """! @brief Add an example to an existing context and set its written form, language and script.
977 Attributes 'writtenForm', 'language' and 'scriptName' are owned by TextRepresentation, which is owned by Context, itself owend by Sense.
978 @param written_form The written form to set.
979 @param language Language used for the written form.
980 @param script_name The name of the script used to write the example, e.g. devanagari.
981 @return LexicalEntry instance.
989 sense.add_example(written_form, language, script_name)
993 """! @brief Set comment of an existing example.
994 Attribute 'comment' is owned by TextRepresentation, which is owned by Context, itself owend by Sense.
995 @param comment The comment to set.
996 @return LexicalEntry instance.
1004 sense.set_example_comment(comment)
1008 """! @brief Set semantic domain and language.
1009 Attributes 'semanticDomain' and 'language' are owned by SubjectField, which is owned by Sense.
1010 @param semantic_domain The semantic domain to set.
1011 @param language Language used to describe the semantic domain.
1012 @return LexicalEntry instance.
1020 sense.set_semantic_domain(semantic_domain, language)
1024 """! @brief Get all semantic domains.
1025 This attribute is owned by SubjectField, which is owned by Sense.
1026 @param language If this argument is given, get only semantic domains that are described using this language.
1027 @return A Python list of filtered SubjectField attributes 'semanticDomain'.
1029 semantic_domains = []
1031 for subject_field
in sense.get_subject_fields():
1032 if subject_field.get_semanticDomain(language)
is not None:
1033 semantic_domains.append(subject_field.get_semanticDomain(language))
1034 semantic_domains += subject_field.get_sub_domains(language)
1035 return semantic_domains
1038 """! @brief Set translation and language.
1039 Attributes 'translation' and 'language' are owned by Equivalent, which is owned by Sense.
1040 @param translation The translation to set.
1041 @param language Language used for the translation.
1042 @return LexicalEntry instance.
1050 sense.set_translation(translation, language)
1053 def set_audio(self, media_type="audio", file_name=None, author=None, quality=None, start_position="T00:00:00
", duration=None, external_reference=None, audio_file_format=None):
1054 """! @brief Set audio resource.
1055 Attributes 'mediaType', 'fileName', 'author', 'quality', 'startPosition', 'durationOfEffectiveSpeech', 'externalReference', 'audioFileFormat' are owned by Material/Audio, which is owned by FormRepresentation, itself owend by Lemma.
1056 @param media_type The media type to set.
1057 @param file_name Name of the audio file.
1058 @param author Author of the recording.
1059 @param quality Quality of the recording, in range 'quality_range' defined in 'common/range.py'.
1060 @param start_position Start position of the form in the recording, in format 'Thh:mm:ss,msms', e.g. "T00:05:00".
1061 @param duration Duration of the effcetive speech, in format 'PThhHmmMssS', e.g. "PT00:05:00".
1062 @param external_reference Reference of the audio file, if not directly provided.
1063 @param audio_file_format Format of the audio file, e.g. "wav".
1064 @return LexicalEntry instance.
1067 if self.
lemma is None:
1068 self.
lemma = Lemma()
1069 self.lemma.set_audio(media_type, file_name, author, quality, start_position, duration, external_reference, audio_file_format)
1073 """! @brief Check if this lexical entry is a subentry.
1074 @return 'True' if it is a subentry, 'False' otherwise.
1078 if related_form.get_semanticRelation() ==
"main entry":
1083 """! @brief Check if this lexical entry has subentries.
1084 @return 'True' if it has subentries, 'False' otherwise.
1088 if related_form.get_semanticRelation() ==
"subentry":
1093 """! @brief Get subentries of this lexical entry.
1094 @return A Python list of LexicalEntry.
1098 if related_form.get_semanticRelation() ==
"subentry":
1099 subentries.append(related_form.get_lexical_entry())
1103 """! @brief If this lexical entry is a subentry, get its main entry.
1104 @return A LexicalEntry if it exists, 'None' otherwise.
1107 if related_form.get_semanticRelation() ==
"main entry":
1108 return related_form.get_lexical_entry()
1111 """! @brief Create and add a component to the lexical entry.
1112 @param position The position of the component in the multiword expression.
1113 @param lexeme Related lexeme.
1114 @return LexicalEntry instance.
1118 self.list_of_components.create_and_add_component(position, lexeme)
1122 """! @brief If this lexical entry is a multiword expression, get its components.
1123 @return A list of components if any, an empty list otherwise.
1127 return self.list_of_components.get_components()
1130 """! @brief Check if this lexical entry is a component.
1131 @return 'True' if it is a component, 'False' otherwise.
1135 if related_form.get_semanticRelation() ==
"complex predicate":
1140 """! @brief Get speaker.
1141 @return LexicalEntry private attribute '__speaker'.
def create_and_add_related_form
Create and add a related form to the lexical entry.
def get_lexeme
Get lexeme.
def get_senses
Get all senses maintained by the lexical entry.
"Lexical Entry is a class representing a lexeme in a given language and is a container for managing t...
def set_dialect
Set dialect.
def get_variant_forms
Get all variant forms of specified type.
def create_and_add_component
Create and add a component to the lexical entry.
def check_attr_type
Check that attribute value is of specified type.
def get_borrowed_word
Get source language (in English).
def create_and_add_example
Add an example to a new context and set its written form, language and script.
id
UID is managed at the Lexicon level.
def set_etymology
Set etymology.
def set_paradigm_form
Set paradigm form.
def set_scientific_name
Set scientific_name.
def set_etymology_comment
Set etymology comment and language.
def set_status
Set lexical entry status.
def set_semantic_domain
Set semantic domain and language.
def get_bibliography
Get lexical entry bibliography.
def add_word_form
Add a word form to the lexical entry.
def get_status
Get lexical entry status.
def set_translation
Set translation and language.
def check_attr_range
Check that attribute value is in specified range.
def create_word_form
Create a word form.
def get_etymology_comment
Get etymology comment.
def get_related_forms
Get all related forms maintained by the lexical entry.
def get_id
Get Unique IDentifier.
def set_audio
Set audio resource.
def set_restriction
Set restriction and language.
def get_independentWord
Get lexical entry independent word indication.
list_of_components
ListOfComponents instance is owned by LexicalEntry There is zero or one ListOfComponents instance per...
def create_example
Create a context.
def get_subentries
Get subentries of this lexical entry.
def get_word_forms
Get all word forms maintained by the lexical entry.
def get_phonetic_forms
Get all phonetic forms.
stem
Stem instances are owned by LexicalEntry There is zero to many Stem instances per LexicalEntry...
sense
Sense instances are owned by LexicalEntry There is zero to many Sense instances per LexicalEntry...
def set_gloss
Set gloss and language.
def set_paradigm
Set paradigm.
def get_etymology_gloss
Get etymology gloss.
def get_tones
Get all tones.
def get_speaker
Get speaker.
def set_written_form
Set loan word.
def create_sense
Create a sense.
def get_spelling_variants
Get all spelling variants.
def create_and_add_sense
Create and add a sense to the lexical entry.
def set_encyclopedic_information
Set encyclopedic information and language.
def get_components
If this lexical entry is a multiword expression, get its components.
def set_script_name
Set script name.
def get_morphologies
Get all morphologies.
def set_partOfSpeech
Set grammatical category.
def get_term_source_language
Get language used for the etymology comment.
def add_related_form
Add a related form to the lexical entry.
def set_lexeme
Set lexeme.
def set_example_comment
Set comment of an existing example.
def set_independentWord
Set lexical entry independent word indication.
lemma
Lemma instance is owned by LexicalEntry There is one Lemma instance by LexicalEntry instance...
def set_phonetic_form
Set phonetic form.
def set_homonymNumber
Set lexical entry homonym number.
related_form
RelatedForm instances are owned by LexicalEntry There is zero to many RelatedForm instances per Lexic...
def is_component
Check if this lexical entry is a component.
def get_partOfSpeech
Get grammatical category.
def get_scientific_name
Get scientific name.
def set_geographical_variant
Set geographical variant.
def get_transliterations
Get all transliterations.
def get_homonymNumber
Get lexical entry homonym number.
def get_written_form
Get loan word.
def set_borrowed_word
Set source language (in English).
def set_date
Set lexical entry date.
def get_paradigms
Get all paradigms.
def get_main_entry
If this lexical entry is a subentry, get its main entry.
def set_morphology
Set morphology.
def is_subentry
Check if this lexical entry is a subentry.
def set_etymology_gloss
Set etymology gloss.
__speaker
Pointer to an existing Speaker There is one Speaker pointer per LexicalEntry instance.
def set_spelling_variant
Set spelling variant.
def get_etymology
Get etymology.
def get_last_sense
Get the previously registered sense.
def get_semantic_domains
Get all semantic domains.
def get_etymology_source
Get etymology source.
def set_contextual_variation
Set contextual variation.
def get_contextual_variations
Get all contextual variations.
def set_variant_form
Set variant form and type.
def set_note
Set note, type and language.
def set_paradigm_label
Set paradigm label.
def create_related_form
Create a related form.
def has_subentries
Check if this lexical entry has subentries.
def add_sense
Add a sense to the lexical entry.
def set_citation_form
Set citation form.
def find_related_forms
Find related lexemes.
def set_definition
Set definition and language.
def get_citation_forms
Get all citation forms.
def get_form_representations
Get all form representations maintained by the lemma.
def find_notes
Find notes.
def set_bibliography
Set lexical entry bibliography.
def find_paradigms
Find paradigms.
def set_etymology_source
Set etymology source.
def get_last_related_form
Get the previously registered related form.
def set_transliteration
Set transliteration.
def set_variant_comment
Set variant comment and language.
def add_example
Add an example to an existing context and set its written form, language and script.
def get_date
Get lexical entry date.
word_form
WordForm instances are owned by LexicalEntry There is zero to many WordForm instances per LexicalEntr...
def set_usage_note
Set usage note and language.