@@ -1119,10 +1119,15 @@ def g_tag (dToken, sTag): "returns True if is present on token " return "aTags" in dToken and sTag in dToken["aTags"] + +def g_meta (dToken, sType): + "returns True if is equal to the token type" + return dToken["sType"] == sType + def g_space_between_tokens (dToken1, dToken2, nMin, nMax=None): "checks if spaces between tokens is >= and <= " nSpace = dToken2["nStart"] - dToken1["nEnd"] if nSpace < nMin: @@ -1188,10 +1193,11 @@ echo("Error. There should be a token at this position: ", nPos) return True dTokenPos[nPos]["lMorph"] = lMorph return True + #### Disambiguation for graph rules def g_select (dToken, sPattern, lDefault=None): "select morphologies for according to , always return True" @@ -1242,10 +1248,16 @@ dToken["lMorph"] = _oSpellChecker.getMorph(dToken["sValue"][slice(nLeft, nRight)]) else: dToken["lMorph"] = _oSpellChecker.getMorph(dToken["sValue"]) return True + +def g_change_meta (dToken, sType): + "Disambiguation: change type of token" + dToken["sType"] = sType + return True + #### GRAMMAR CHECKER PLUGINS ${plugins}