Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dictionary_ru.lst filter=lfs diff=lfs merge=lfs -text
dictionary_sv.lst filter=lfs diff=lfs merge=lfs -text
dictionary_tr.lst filter=lfs diff=lfs merge=lfs -text
inflectional_ar.xml filter=lfs diff=lfs merge=lfs -text
dictionary_ml.lst filter=lfs diff=lfs merge=lfs -text
inflectional_da.xml filter=lfs diff=lfs merge=lfs -text
inflectional_de.xml filter=lfs diff=lfs merge=lfs -text
inflectional_en.xml filter=lfs diff=lfs merge=lfs -text
Expand All @@ -27,5 +28,6 @@ inflectional_nb.xml filter=lfs diff=lfs merge=lfs -text
inflectional_nl.xml filter=lfs diff=lfs merge=lfs -text
inflectional_pt.xml filter=lfs diff=lfs merge=lfs -text
inflectional_ru.xml filter=lfs diff=lfs merge=lfs -text
inflectional_ml.xml filter=lfs diff=lfs merge=lfs -text
inflectional_sv.xml filter=lfs diff=lfs merge=lfs -text
inflectional_tr.xml filter=lfs diff=lfs merge=lfs -text
Git LFS file not shown
Git LFS file not shown
83 changes: 83 additions & 0 deletions inflection/resources/org/unicode/inflection/features/grammar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1624,6 +1624,89 @@
</category>
</grammar>
</language>
<language id="ml">
<grammar>
<category name="case">
<grammeme name="nominative"/> <!-- no explicit marker; subject form -->
<grammeme name="accusative"/> <!-- -യെ, -ായെ, marks direct object -->
<grammeme name="genitive"/> <!-- -ന്റെ, -യുടെ (possessive) -->
<grammeme name="dative"/> <!-- -ക്ക്, -ന് (to/for) -->
<grammeme name="instrumental"/> <!-- -ആല് (by means of) -->
<grammeme name="locative"/> <!-- -യില് (in/at) -->
<grammeme name="ablative"/> <!-- -യില് നിന്നു് (from) -->
<grammeme name="vocative"/> <!-- used in direct address -->
</category>
<category name="number">
<grammeme name="singular"/>
<grammeme name="plural"/>
</category>
<category name="person">
<restrictions>
<restriction name="pos" value="pronoun"/>
<restriction name="pos" value="verb"/>
</restrictions>
<grammeme name="first"/>
<grammeme name="second"/>
<grammeme name="third"/>
</category>
<category name="gender">
<restrictions>
<restriction name="pos" value="pronoun"/>
<restriction name="pos" value="verb"/>
</restrictions>
<grammeme name="masculine"/>
<grammeme name="feminine"/>
<grammeme name="neuter"/> <!-- e.g. for objects or animals -->
</category>
<category name="tense">
<restrictions>
<restriction name="pos" value="verb"/>
</restrictions>
<grammeme name="past"/>
<grammeme name="present"/>
<grammeme name="future"/>
</category>
<category name="mood">
<restrictions>
<restriction name="pos" value="verb"/>
</restrictions>
<grammeme name="indicative"/>
<grammeme name="imperative"/>
<grammeme name="subjunctive"/>
</category>
<category name="voice">
<restrictions>
<restriction name="pos" value="verb"/>
</restrictions>
<grammeme name="active"/>
<grammeme name="passive"/>
</category>
<category name="formality">
<restrictions>
<restriction name="pos" value="pronoun"/>
<restriction name="pos" value="verb"/>
</restrictions>
<grammeme name="intimate"/>
<grammeme name="casual"/>
<grammeme name="formal"/>
<grammeme name="honorific"/>
</category>
<category name="aspect">
<restrictions>
<restriction name="pos" value="verb"/>
</restrictions>
<grammeme name="perfective"/>
<grammeme name="imperfective"/>
</category>
<category name="negation">
<restrictions>
<restriction name="pos" value="verb"/>
</restrictions>
<grammeme name="affirmative"/>
<grammeme name="negative"/>
</category>
</grammar>
</language>
<language id="ms">
<grammar>
<category name="clusivity">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
എനിക്ക്,first,singular,dative
ഞാൻ,first,singular,nominative
എന്നെ,first,singular,accusative
എൻ്റെ,first,singular,genitive,dependency=dependent
എൻ്റെത്,first,singular,genitive,dependency=independent
നമുക്ക്,first,plural,dative
ഞങ്ങൾ,first,plural,nominative
ഞങ്ങളെ,first,plural,accusative
ഞങ്ങളുടെ,first,plural,genitive,dependency=dependent
ഞങ്ങളുടേതു്,first,plural,genitive,dependency=independent
നമ്മുടെ,first,plural,genitive,dependency=dependent
നമ്മുടേതു്,first,plural,genitive,dependency=independent
നിനക്ക്,second,singular,dative,dependency=nonhonorific
നീ,second,singular,nominative,dependency=nonhonorific
നിനെ,second,singular,accusative,dependency=nonhonorific
നിന്റെ,second,singular,genitive,dependency=dependent,dependency=nonhonorific
നിന്റേതു്,second,singular,genitive,dependency=independent,dependency=nonhonorific
നിങ്ങൾക്ക്,second,plural,dative,dependency=honorific
നിങ്ങൾ,second,plural,nominative,dependency=honorific
നിങ്ങളെ,second,plural,accusative,dependency=honorific
നിങ്ങളുടെ,second,plural,genitive,dependency=dependent,dependency=honorific
നിങ്ങളുടേതു്,second,plural,genitive,dependency=independent,dependency=honorific
അവൻ,third,singular,nominative,masculine
അവനെ,third,singular,accusative,masculine
അവൻ്റെ,third,singular,genitive,dependency=dependent,masculine
അവൻ്റെത്,third,singular,genitive,dependency=independent,masculine
അവൾ,third,singular,nominative,feminine
അവളെ,third,singular,accusative,feminine
അവളുടെ,third,singular,genitive,dependency=dependent,feminine
അവളുടേതു്,third,singular,genitive,dependency=independent,feminine
അത്,third,singular,nominative,neuter
അതിനെ,third,singular,accusative,neuter
അതിന്റെ,third,singular,genitive,dependency=dependent,neuter
അതിന്റേതു്,third,singular,genitive,dependency=independent,neuter
അവർ,third,plural,nominative
അവരെ,third,plural,accusative
അവരുടെ,third,plural,genitive,dependency=dependent
അവരുടേതു്,third,plural,genitive,dependency=independent

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ locale.group.it=it_IT,it_CH
locale.group.ja=ja_JP
locale.group.ko=ko_KR
locale.group.ms=ms_MY
locale.group.ml=ml_IN
locale.group.nb=nb_NO
locale.group.nl=nl_NL,nl_BE
locale.group.pt=pt_BR,pt_PT
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
# Copyright 2025 Unicode Incorporated and others. All rights reserved.
#
tokenizer.implementation.class=DefaultTokenizer

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright 2025 Apple Inc. All rights reserved.
*/
#include <inflection/dialog/language/MlCommonConceptFactory.hpp>

namespace inflection::dialog::language {

MlCommonConceptFactory::MlCommonConceptFactory(const ::inflection::util::ULocale& language)
: super(language)
{
}

MlCommonConceptFactory::~MlCommonConceptFactory()
{
}

} // namespace inflection::dialog::language
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright 2025 Apple Inc. All rights reserved.
*/
#pragma once

#include <inflection/dialog/language/fwd.hpp>
#include <inflection/dialog/CommonConceptFactoryImpl.hpp>

class inflection::dialog::language::MlCommonConceptFactory
: public CommonConceptFactoryImpl
{
public:
typedef CommonConceptFactoryImpl super;
public:
explicit MlCommonConceptFactory(const ::inflection::util::ULocale& language);
~MlCommonConceptFactory() override;
};
3 changes: 2 additions & 1 deletion inflection/src/inflection/dialog/language/fwd.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2024 Apple Inc. All rights reserved.
* Copyright 2017-2025 Apple Inc. All rights reserved.
*/
// Forward declarations for inflection.dialog.language
#pragma once
Expand Down Expand Up @@ -28,6 +28,7 @@ namespace inflection
class JaCommonConceptFactory;
class KoCommonConceptFactory;
class KoCommonConceptFactory_KoAndList;
class MlCommonConceptFactory;
class MsCommonConceptFactory;
class NbCommonConceptFactory;
class NlCommonConceptFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2024 Apple Inc. All rights reserved.
* Copyright 2017-2025 Apple Inc. All rights reserved.
*/
#include <inflection/grammar/synthesis/GrammarSynthesizerFactory.hpp>

Expand All @@ -13,6 +13,7 @@
#include <inflection/grammar/synthesis/HiGrammarSynthesizer.hpp>
#include <inflection/grammar/synthesis/ItGrammarSynthesizer.hpp>
#include <inflection/grammar/synthesis/KoGrammarSynthesizer.hpp>
#include <inflection/grammar/synthesis/MlGrammarSynthesizer.hpp>
#include <inflection/grammar/synthesis/NbGrammarSynthesizer.hpp>
#include <inflection/grammar/synthesis/NlGrammarSynthesizer.hpp>
#include <inflection/grammar/synthesis/PtGrammarSynthesizer.hpp>
Expand Down Expand Up @@ -41,6 +42,7 @@ static const ::std::map<::inflection::util::ULocale, addSemanticFeatures>& GRAMM
{::inflection::util::LocaleUtils::HINDI(), &HiGrammarSynthesizer::addSemanticFeatures},
{::inflection::util::LocaleUtils::ITALIAN(), &ItGrammarSynthesizer::addSemanticFeatures},
{::inflection::util::LocaleUtils::KOREAN(), &KoGrammarSynthesizer::addSemanticFeatures},
{::inflection::util::LocaleUtils::MALAYALAM(), &MlGrammarSynthesizer::addSemanticFeatures},
{::inflection::util::LocaleUtils::NORWEGIAN(), &NbGrammarSynthesizer::addSemanticFeatures},
{::inflection::util::LocaleUtils::DUTCH(), &NlGrammarSynthesizer::addSemanticFeatures},
{::inflection::util::LocaleUtils::PORTUGUESE(), &PtGrammarSynthesizer::addSemanticFeatures},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2025 Apple Inc. All rights reserved.
*/
#include <inflection/grammar/synthesis/MlGrammarSynthesizer.hpp>

#include <inflection/dialog/SemanticFeatureModel.hpp>
#include <inflection/grammar/synthesis/MlGrammarSynthesizer_CountLookupFunction.hpp>
#include <inflection/grammar/synthesis/MlGrammarSynthesizer_GenderLookupFunction.hpp>
#include <inflection/grammar/synthesis/MlGrammarSynthesizer_CaseLookupFunction.hpp>
#include <inflection/grammar/synthesis/MlGrammarSynthesizer_MlDisplayFunction.hpp>
#include <inflection/grammar/synthesis/GrammemeConstants.hpp>

namespace inflection::grammar::synthesis {

void MlGrammarSynthesizer::addSemanticFeatures(::inflection::dialog::SemanticFeatureModel& featureModel)
{
featureModel.putDefaultFeatureFunctionByName(GrammemeConstants::NUMBER, new MlGrammarSynthesizer_CountLookupFunction());
featureModel.putDefaultFeatureFunctionByName(GrammemeConstants::GENDER, new MlGrammarSynthesizer_GenderLookupFunction());
featureModel.putDefaultFeatureFunctionByName(GrammemeConstants::CASE, new MlGrammarSynthesizer_CaseLookupFunction());

featureModel.setDefaultDisplayFunction(new MlGrammarSynthesizer_MlDisplayFunction(featureModel));
}

} // namespace inflection::grammar::synthesis

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright 2025 Apple Inc. All rights reserved.
*/
#pragma once

#include <inflection/dialog/fwd.hpp>
#include <inflection/grammar/synthesis/fwd.hpp>
#include <string>

class inflection::grammar::synthesis::MlGrammarSynthesizer final
{
public:
static void addSemanticFeatures(::inflection::dialog::SemanticFeatureModel& featureModel);
private:
MlGrammarSynthesizer() = delete;
};

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2025 Apple Inc. All rights reserved.
*/
#include <inflection/grammar/synthesis/MlGrammarSynthesizer_CaseLookupFunction.hpp>

#include <inflection/grammar/synthesis/GrammemeConstants.hpp>
#include <inflection/dialog/SemanticFeature.hpp>
#include <inflection/dialog/DisplayValue.hpp>
#include <inflection/dialog/SpeakableString.hpp>
#include <inflection/util/LocaleUtils.hpp>
#include <inflection/util/StringViewUtils.hpp>

namespace inflection::grammar::synthesis {

MlGrammarSynthesizer_CaseLookupFunction::MlGrammarSynthesizer_CaseLookupFunction()
: super()
{
// No file needed
}

inflection::dialog::SpeakableString* MlGrammarSynthesizer_CaseLookupFunction::getFeatureValue(const ::inflection::dialog::DisplayValue& displayValue, const ::std::map<::inflection::dialog::SemanticFeature, ::std::u16string>& /*constraints*/) const
{
std::u16string displayString;
::inflection::util::StringViewUtils::lowercase(&displayString, displayValue.getDisplayString(), ::inflection::util::LocaleUtils::MALAYALAM());

if (displayString.length() >= 3) {
// Genitive-indicative suffixes in Malayalam
if (displayString.ends_with(u"ഉടെ") || // uṭe
displayString.ends_with(u"യുടെ") || // yude (my, your, his, her...)
displayString.ends_with(u"ന്റെ") || // ente (mine), avante, etc.
displayString.ends_with(u"ആയുടെ")) // āyuṭe (fem. 3rd person possessive)
{
return new ::inflection::dialog::SpeakableString(GrammemeConstants::CASE_GENITIVE());
}
}
return nullptr;
}

} // namespace inflection::grammar::synthesis

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2025 Apple Inc. All rights reserved.
*/
#pragma once

#include <inflection/dialog/fwd.hpp>
#include <inflection/grammar/synthesis/fwd.hpp>
#include <inflection/dialog/DefaultFeatureFunction.hpp>
#include <set>
#include <string>

class inflection::grammar::synthesis::MlGrammarSynthesizer_CaseLookupFunction
: public ::inflection::dialog::DefaultFeatureFunction
{
public:
typedef ::inflection::dialog::DefaultFeatureFunction super;

public:
::inflection::dialog::SpeakableString* getFeatureValue(const ::inflection::dialog::DisplayValue& displayValue, const ::std::map<::inflection::dialog::SemanticFeature, ::std::u16string>& constraints) const override;

MlGrammarSynthesizer_CaseLookupFunction();
MlGrammarSynthesizer_CaseLookupFunction(const MlGrammarSynthesizer_CaseLookupFunction&) = delete;
MlGrammarSynthesizer_CaseLookupFunction& operator=(const MlGrammarSynthesizer_CaseLookupFunction&) = delete;
};

Loading
Loading