Interface IMarkovModel
- All Superinterfaces:
com.github.szgabsz91.morpher.core.io.IConvertable<MarkovModelMessage>
- All Known Implementing Classes:
FullMarkovModel
public interface IMarkovModel
extends com.github.szgabsz91.morpher.core.io.IConvertable<MarkovModelMessage>
Base Markov model interface.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the list of affix types to the model.com.github.szgabsz91.morpher.languagehandlers.api.model.AffixTypeChaincalculateProbabilities(List<com.github.szgabsz91.morpher.core.model.AffixType> affixTypes) Creates a newAffixTypeChaincontaining the appropriate part of speech tag and the given list of affix types, with the calculated local probabilities.doublecalculateProbability(List<com.github.szgabsz91.morpher.core.model.AffixType> affixTypeChain) Calculates the probability of the affix type chain given with its list ofAffixTypes.List<com.github.szgabsz91.morpher.languagehandlers.api.model.ProbabilisticAffixType> getCandidates(List<com.github.szgabsz91.morpher.core.model.AffixType> affixTypes) Returns the candidates after the given list of affix types.com.github.szgabsz91.morpher.languagehandlers.api.model.ProbabilisticAffixTypegetProbabilityOfPOS(com.github.szgabsz91.morpher.core.model.AffixType pos) Returns the affix type with its probability for the given part of speech tag.booleanisAffixTypeChainValid(List<com.github.szgabsz91.morpher.core.model.AffixType> affixTypeChain) Returns if the given affix type chain is valid or not.reverse()Reverses thisIMarkovModel.List<com.github.szgabsz91.morpher.languagehandlers.api.model.AffixTypeChain> sortAffixTypes(Set<com.github.szgabsz91.morpher.core.model.AffixType> affixTypes, Predicate<com.github.szgabsz91.morpher.core.model.AffixType> posPredicate) Tries to sort the given set of affix types, and returns a list ofAffixTypeChainobjects.Methods inherited from interface com.github.szgabsz91.morpher.core.io.IConvertable
fromMessage, fromMessage, toMessage
-
Field Details
-
START
static final com.github.szgabsz91.morpher.core.model.AffixType STARTThe start affix type. -
END
static final com.github.szgabsz91.morpher.core.model.AffixType ENDThe end affix type.
-
-
Method Details
-
add
Adds the list of affix types to the model.- Parameters:
affixTypes- the list of affix types
-
isAffixTypeChainValid
boolean isAffixTypeChainValid(List<com.github.szgabsz91.morpher.core.model.AffixType> affixTypeChain) Returns if the given affix type chain is valid or not.- Parameters:
affixTypeChain- the affix type chain to check- Returns:
- true if the affix type chain is valid, false otherwise
-
sortAffixTypes
List<com.github.szgabsz91.morpher.languagehandlers.api.model.AffixTypeChain> sortAffixTypes(Set<com.github.szgabsz91.morpher.core.model.AffixType> affixTypes, Predicate<com.github.szgabsz91.morpher.core.model.AffixType> posPredicate) Tries to sort the given set of affix types, and returns a list ofAffixTypeChainobjects.- Parameters:
affixTypes- the set of affix typesposPredicate- predicate that returns if a given affix type is a part-of-speech tag or not- Returns:
- the list of
AffixTypeChainobjects
-
calculateProbabilities
com.github.szgabsz91.morpher.languagehandlers.api.model.AffixTypeChain calculateProbabilities(List<com.github.szgabsz91.morpher.core.model.AffixType> affixTypes) Creates a newAffixTypeChaincontaining the appropriate part of speech tag and the given list of affix types, with the calculated local probabilities.- Parameters:
affixTypes- the affix types on the chain- Returns:
- the created
AffixTypeChain
-
calculateProbability
Calculates the probability of the affix type chain given with its list ofAffixTypes.- Parameters:
affixTypeChain- the list ofAffixTypes on the affix type chain- Returns:
- the probability of the affix type chain
-
getProbabilityOfPOS
com.github.szgabsz91.morpher.languagehandlers.api.model.ProbabilisticAffixType getProbabilityOfPOS(com.github.szgabsz91.morpher.core.model.AffixType pos) Returns the affix type with its probability for the given part of speech tag.- Parameters:
pos- the part of speech tag- Returns:
- the
ProbabilisticAffixTypeinstance
-
getCandidates
List<com.github.szgabsz91.morpher.languagehandlers.api.model.ProbabilisticAffixType> getCandidates(List<com.github.szgabsz91.morpher.core.model.AffixType> affixTypes) Returns the candidates after the given list of affix types.- Parameters:
affixTypes- the already processed list of affix types- Returns:
- the list of candidates, sorted by relative frequencies, in descending order
-
reverse
IMarkovModel reverse()Reverses thisIMarkovModel.- Returns:
- the reversed
IMarkovModel
-