Ce module définit deux fonctions pour la détection des lemmes.
isLemma()
Indique si les informations grammaticales données constituent un lemme.
langCode
(string) : Le code de langue.wordType
(string) : Le type de mot (cf. Module:types de mots/data).isFlexion
(boolean) : Indique si le terme est une flexion.isLocution
(boolean) : Indique si le terme est une locution.getLemmaCategoryName()
Construit le nom de la catégorie de lemme pour la langue donnée à partir des informations grammaticales passées. Si le terme est un lemme, une chaine au format Lemmes en <langue>
est retournée, sinon une chaine vide est retournée.
langCode
(string) : Le code de langue.wordType
(string) : Le type de mot (cf. Module:types de mots/data).isFlexion
(boolean) : Indique si le terme est une flexion.isLocution
(boolean) : Indique si le terme est une locution.La documentation de ce module est générée par le modèle {{Documentation module}}.
Elle est incluse depuis la page Module:lemme/Documentation. Veuillez placer les catégories sur cette page-là.
Les éditeurs peuvent travailler dans le bac à sable (créer).
Voir les statistiques d'appel depuis le wikicode sur l'outil wstat et les appels depuis d'autres modules.
local m_langues = require("Module:langues")
local m_typesDeMots = require("Module:types de mots")
local p = {}
-- Critères basés sur ]
local validLangCodes = {
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
}
local invalidTypes = {
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
}
--- Indicate whether the given grammatical information constitutes a lemma.
--- @param langCode string The language code.
--- @param wordType string The word type as defined in ].
--- @param isFlexion boolean Whether the entry is a flexion.
--- @param isLocution boolean Whether the entry is a locution (contains multiple words).
--- @return boolean True if the language code and word type are valid, and flexion and locution are false.
function p.isLemma(langCode, wordType, isFlexion, isLocution)
return langCode
and validLangCodes
and not isFlexion
and wordType
and m_typesDeMots.isValidWordType(wordType)
and not invalidTypes
and not isLocution
end
--- Return the lemma category name for the given grammatical information.
--- @param langCode string The language code.
--- @param wordType string The word type as defined in ].
--- @param isFlexion boolean Whether the entry is a flexion.
--- @param isLocution boolean Whether the entry is a locution (contains multiple words).
--- @return string|nil Nil if any argument is nil, the category name if the entry is a lemma, an empty string otherwise.
function p.getLemmaCategoryName(langCode, wordType, isFlexion, isLocution)
if langCode == nil or wordType == nil then
return nil
end
if p.isLemma(langCode, wordType, isFlexion, isLocution) then
local langName = m_langues.getName(langCode)
if langName then
return "Lemmes en " .. langName
else
return ""
end
end
end
return p