public RegConst(string text, WordTypes regplace, bool hasNeedSpace) { info = new InfoArguments(); info.regplace = regplace; info.hasNeedSpace = hasNeedSpace; test = text; }
public static WordTypes FindTypeOfItem(string word) { //Finds out the type of the word given. Or more precisely, if the word is a "object" type word, //in other words a pronoun/noun/name or some thing else. It returns other if it is a "object" word. WordTypes wordType = WordTypes.None; if (ModifierList.Contains(word)) { wordType = wordType | WordTypes.Modifier; } if (PrepositionList.Contains(word)) { wordType = wordType | WordTypes.Preposition; } if (AdverbList.Contains(word)) { wordType = wordType | WordTypes.Adverb; } if (wordType == WordTypes.None) { return(WordTypes.Other); } else { return(wordType); } }
/// <summary> /// This method finds all longest suitable words in lines /// </summary> /// <param name="lines"></param> /// <param name="type"></param> /// <returns></returns> public static List <string> ConditionalLengthWords(string[] lines, WordTypes type) { Predicate <string> condition = getConditionFromWordType(type); List <string> maxLengthWords = new List <string>(); int maxLength = -1; foreach (var line in lines) { string[] words = LineState.SplitLine(line); foreach (var word in words) { if (!condition(word)) { continue; } else if (word.Length > maxLength) { maxLength = word.Length; maxLengthWords.Clear(); maxLengthWords.Add(word); } else if (word.Length == maxLength) { maxLengthWords.Add(word); } } } return(maxLengthWords); }
public RegTest(Regex reg, WordTypes regplace,bool hasNeedSpace) { this.reg = reg; info = new InfoArguments(); info.regplace = regplace; info.hasNeedSpace = hasNeedSpace; }
public WordEditorViewModel(WordDisplayModel model) { WordTypes.AddRange(typeof(WordType).ToList().Select(p => new WordTypeDisplayModel() { Type = (WordType)p.Key })); this.Model = model; }
public TextGenerator(WordTypes wordType = WordTypes.Word) { if (wordType == WordTypes.Name) this.corpus = Corpus.DeserializeFromEmbeddedResource("names.bin"); else this.corpus = Corpus.DeserializeFromEmbeddedResource("text.bin"); this.wordType = wordType; }
public Word(string word, WordDisplay display, float fallSpeed, Transform target, WordTypes wordType = WordTypes.NORMAL) { this.wordType = wordType; this.word = word; this.typeIndex = 0; this.display = display; this.display.SetWord(word, fallSpeed, target, wordType); }
Color GetWordColor(WordTypes wordType) { switch (wordType) { case WordTypes.TIME_BOMB: return(Color.green); default: return(Color.white); } }
/// <summary> /// This method calculates the number of entering some type of word in text /// </summary> /// <param name="lines"></param> /// <param name="type"></param> /// <returns></returns> public static int CountThroughText(string[] lines, WordTypes type) { Predicate <string> condition = getConditionFromWordType(type); int countInText = 0; foreach (var line in lines) { countInText += LineState.FindCountOfWords(line, condition); } return(countInText); }
public void SetWord(string word, float fallSpeed, Transform target, WordTypes wordType) { this.fallSpeed = fallSpeed; if (text == null) { text = GetComponent <TMPro.TextMeshProUGUI>(); } text.text = word; initialColor = text.color; text.color = GetWordColor(wordType); this.target = target; }
private static Predicate <string> getConditionFromWordType(WordTypes type) { Predicate <string> condition = null; switch (type) { case WordTypes.Word: condition = Conditions.IsWord; break; case WordTypes.AnyWord: condition = Conditions.IsAnyWord; break; case WordTypes.TrueWord: condition = Conditions.IsTrueWord; break; case WordTypes.GenericWord: condition = Conditions.IsGenericWord; break; case WordTypes.AcronimWord: condition = Conditions.IsAcronimWord; break; } return(condition); }
private static Logic getCurrentLogic(string word, int lineNumber, Scope currentScope) { if (word == ",") { return(new CommaSign()); } if (word == ">") { return(new GreaterThenSign()); } if (word == "<") { return(new LessThenSign()); } if (word == ":") { return(new IndentOperator()); } if (word == "!") { return(new XorOperator(word)); } if (word == "not") { return(new NotOperator(word)); } if (word == "or") { return(new OrOperator(word)); } if (word == "and") { return(new AndOperator(word)); } if (isBooleanValue(word) == 1) { return(new BooleanValue(true)); } if (isBooleanValue(word) == 0) { return(new BooleanValue(false)); } if (isNumber(word)) { return(new NumberValue(word)); } if (isString(word)) { return(new TextValue(word)); } if (SpecialWordParser.isKeyWord(word)) { SpecialWordParser.checkIfUnsupportedKeyword(word, lineNumber); WordTypes specialType = SpecialWordParser.getSpecialType(word, lineNumber); if (specialType == WordTypes.forLoop) { return(new ForLoop()); } if (specialType == WordTypes.whileLoop) { return(new WhileLoop()); } if (specialType == WordTypes.ifOperator) { return(new IfStatement()); } if (specialType == WordTypes.elifOperator) { return(new ElifStatement()); } if (specialType == WordTypes.elseOperator) { return(new ElseStatement()); } if (specialType == WordTypes.defStatement) { return(new DefStatement()); } if (specialType == WordTypes.returnStatement) { return(new ReturnStatement()); } if (specialType == WordTypes.breakStatement) { return(new BreakStatement()); } if (specialType == WordTypes.continueStatement) { return(new ContinueStatment()); } } if (startsWithDigitOrWeirdChar(word) == false) { if (endsWithParantes(word)) { Logic temp = FunctionParser.parseIntoFunctionCall(word, lineNumber, currentScope); if (temp != null) { return(temp); } } else { if (containsButNotStartWithDigitWeirdChar(word) == false) { return(checkVariable(word, currentScope.scopeVariables)); } } } if (word.Length == 1) { if (word [0] == '=') { return(new EqualSign()); } if (isMathOperator(word[0])) { return(new MathOperator(word)); } } if (isPackage(word)) { return(new Package(word, lineNumber)); } return(new UnknownLogic(lineNumber)); }
public void setLogic(string word, WordTypes currentType) { base.currentType = currentType; base.word = word; }
private void GenerateAfterCurrentMember() { AbbrevationSnippet abbrevationSnippet; int TotalLenghtArray = 0; int index = 0; QuickGenerator.Abbreviation.WordTypes[] regPlace = null; System.Text.StringBuilder sb = null; ScintillaControl sci = ASCompletion.Context.ASContext.CurSciControl; string nl = ASCompletion.Completion.ASComplete.GetNewLineMarker(sci.EOLMode); bool hasImport = false; bool hasAfterCurrentMember =false; bool hasEvent = false; foreach (String afterName in currentCreateWords.AfterCurrentMember) { if (dictAbbreviations.TryGetValue(afterName, out abbrevationSnippet)) { if (abbrevationSnippet.HasAfterCurrentMember) hasAfterCurrentMember = true; if (abbrevationSnippet.HasEventHandler) hasEvent = true; if (abbrevationSnippet.HasImport) hasImport = true; if (abbrevationSnippet.Arguments == null) TotalLenghtArray += 0; else TotalLenghtArray += abbrevationSnippet.Arguments.Length; if (regPlace == null) { if(abbrevationSnippet.Arguments==null) regPlace = new WordTypes[0]; else regPlace = new WordTypes[abbrevationSnippet.Arguments.Length]; sb = new System.Text.StringBuilder(abbrevationSnippet.Snippet.Length); sb.Append(abbrevationSnippet.Snippet); } else { sb.Append(nl); sb.Append(abbrevationSnippet.Snippet); index = regPlace.Length; Array.Resize(ref regPlace, TotalLenghtArray); } if (abbrevationSnippet.Arguments != null) abbrevationSnippet.Arguments.CopyTo(regPlace, index); } } if (sb == null) { currentCreateWords.ConvertLastWord(); return; } AbbrevationSnippet newAbbreviation = new AbbrevationSnippet(sb.ToString()); if(regPlace.Length!=0) newAbbreviation.Arguments = regPlace; else newAbbreviation.Arguments = null; newAbbreviation.HasImport = hasImport; newAbbreviation.HasEventHandler = hasEvent; newAbbreviation.HasAfterCurrentMember = hasAfterCurrentMember; MemberModel mm = ASContext.Context.CurrentMember; ClassModel cm =ASContext.Context.CurrentClass; int numBraces = 0; if (cm.LineTo == mm.LineTo) numBraces++; MemberModel item; int length = cm.Members.Count; for (int i = 0; i < length; i++) { item = cm.Members[i]; if (item.Name != mm.Name) { if (item.LineTo == mm.LineTo) numBraces++; } } int pos = 0; int currentPos = sci.CurrentPos; if (numBraces > 0) { string linestr = sci.GetLine(mm.LineTo); int indexBrace = 0; for (int i = 0; i < numBraces; i++) { indexBrace = linestr.LastIndexOf('}'); } pos = sci.PositionFromLine(mm.LineTo); pos += indexBrace ; } else { pos = sci.PositionFromLine(mm.LineTo + 1); } string tabString = new string('\t', sci.GetLineIndentation(mm.LineFrom) / sci.Indent); sci.InsertText(pos, nl + tabString + nl); pos = pos + tabString.Length + nl.Length; // sci.GotoPos(pos + tabString.Length +nl.Length ); sci.GotoPos(pos); // sci.MBSafeGotoPos(pos + tabString.Length + nl.Length); // string tabString2 = new string('\t', sci.GetLineIndentation(sci.LineFromPosition(pos)) / sci.Indent); string newSnippet = currentCreateWords.MakeTextFromSnippet(sci, newAbbreviation); sci.InsertText(pos, newSnippet); //sci.MBSafeInsertText(sci.CurrentPos, newSnippet); sci.GotoPos(currentPos); currentCreateWords.ConvertLastWord(); }
internal static string ExtractAllophoneListFromSayData(string zSayData) { string WordToLookUp = ""; int SpacesToDo = 0; int CommasToDo = 0; char xChar; StringBuilder AlloPhoneList = new StringBuilder(); WordTypes WordType = WordTypes.wtNone; WordTypes OldWordType = WordTypes.wtNone; string SayDataWork = zSayData + " "; for (int X = 0; X < SayDataWork.Length; X++) { xChar = SayDataWork[X]; if ((xChar >= 'A' && xChar <= 'Z') || (xChar >= 'a' && xChar <= 'z') || (xChar >= '0' && xChar <= '9') || (xChar == '\\')) { WordType = WordTypes.wtText; WordToLookUp = WordToLookUp + xChar; } else if (xChar == ' ') { WordType = WordTypes.wtSpaces; SpacesToDo++; } else if (xChar == ',') { WordType = WordTypes.wtCommas; CommasToDo++; } if (WordType != OldWordType) { switch (OldWordType) { case WordTypes.wtText: if (WordToLookUp.StartsWith("\\")) { AlloPhoneList.Append(WordToLookUp); } else { AlloPhoneList.Append(ExtractAllophoneListFromSayData(ReadDict("Words", WordToLookUp, ""))); } WordToLookUp = ""; break; case WordTypes.wtCommas: int tempForEndVar2 = CommasToDo; for (int xCounter = 0; xCounter < tempForEndVar2; xCounter++) { AlloPhoneList.Append(" \\P2"); if (WordType == WordTypes.wtCommas) { WordType = WordTypes.wtNone; } } CommasToDo = 0; break; case WordTypes.wtSpaces: switch (SpacesToDo) { case 1: // Add nothing break; case 2: AlloPhoneList.Append(" \\P6"); break; default: AlloPhoneList.Append(" \\P4 \\P1"); break; } SpacesToDo = 0; break; } OldWordType = WordType; } } return(AlloPhoneList.ToString()); }
public void AddWord(WordTypes wordType = WordTypes.NORMAL) { Word word = new Word(WordGenerator.GetRandomWord(), wordSpawner.SpawnWord(), wordFallSpeed, player.transform, wordType); words.Add(word); }
public DictionaryWord(string word, WordTypes wordType) { Word = word; //WordTypeEnum = wordType; }