public void LoadLexicons() { Lexicon.Clear(); Lexicon.AddLexicon(initial.bytes); foreach (var a in assets) { Cdn.cache.GetBytes(a.path, bytes => { if (bytes != null) { Lexicon.AddLexicon(bytes); } }); } Lexicon.SetLanguage(GetLanguage()); }
/// <summary> /// Packs a collection of images into a single image. /// </summary> /// <param name="imageFiles">The list of file paths of the images to be combined.</param> /// <param name="requirePowerOfTwo">Whether or not the output image must have a power of two size.</param> /// <param name="requireSquareImage">Whether or not the output image must be a square.</param> /// <param name="maximumWidth">The maximum width of the output image.</param> /// <param name="maximumHeight">The maximum height of the output image.</param> /// <param name="imagePadding">The amount of blank space to insert in between individual images.</param> /// <param name="generateMap">Whether or not to generate the map dictionary.</param> /// <param name="outputImage">The resulting output image.</param> /// <param name="outputMap">The resulting output map of placement rectangles for the images.</param> /// <returns>0 if the packing was successful, error code otherwise.</returns> /* public int PackImage( IEnumerable<string> imageFiles, bool requirePowerOfTwo, bool requireSquareImage, int maximumWidth, int maximumHeight, int imagePadding, bool generateMap, out Bitmap outputImage, out Dictionary<string, Rectangle> outputMap) { files = new List<string>(imageFiles); requirePow2 = requirePowerOfTwo; requireSquare = requireSquareImage; outputWidth = maximumWidth; outputHeight = maximumHeight; padding = imagePadding; outputImage = null; outputMap = null; // make sure our dictionaries are cleared before starting imageSizes.Clear(); imagePlacement.Clear(); // get the sizes of all the images foreach (var image in files) { Bitmap bitmap = Bitmap.FromFile(image) as Bitmap; if (bitmap == null) return (int)FailCode.FailedToLoadImage; imageSizes.Add(image, bitmap.Size); } // sort our files by file size so we place large sprites first files.Sort( (f1, f2) => { Size b1 = imageSizes[f1]; Size b2 = imageSizes[f2]; int c = -b1.Width.CompareTo(b2.Width); if (c != 0) return c; c = -b1.Height.CompareTo(b2.Height); if (c != 0) return c; return f1.CompareTo(f2); }); // try to pack the images if (!PackImageRectangles()) return (int)FailCode.FailedToPackImage; // make our output image outputImage = CreateOutputImage(); if (outputImage == null) return (int)FailCode.FailedToSaveImage; if (generateMap) { // go through our image placements and replace the width/height found in there with // each image's actual width/height (since the ones in imagePlacement will have padding) string[] keys = new string[imagePlacement.Keys.Count]; imagePlacement.Keys.CopyTo(keys, 0); foreach (var k in keys) { // get the actual size Size s = imageSizes[k]; // get the placement rectangle Rectangle r = imagePlacement[k]; // set the proper size r.Width = s.Width; r.Height = s.Height; // insert back into the dictionary imagePlacement[k] = r; } // copy the placement dictionary to the output outputMap = new Dictionary<string, Rectangle>(); foreach (var pair in imagePlacement) { outputMap.Add(pair.Key, pair.Value); } } // clear our dictionaries just to free up some memory imageSizes.Clear(); imagePlacement.Clear(); return 0; }*/ // This method does some trickery type stuff where we perform the TestPackingImages method over and over, // trying to reduce the image size until we have found the smallest possible image we can fit. private bool PackImageRectangles() { // create a dictionary for our test image placements Lexicon<string, Rectangle> testImagePlacement = new Lexicon<string, Rectangle>(); // get the size of our smallest image int smallestWidth = int.MaxValue; int smallestHeight = int.MaxValue; foreach (var size in imageSizes) { smallestWidth = Math.Min(smallestWidth, size.Value.Width); smallestHeight = Math.Min(smallestHeight, size.Value.Height); } // we need a couple values for testing int testWidth = outputWidth; int testHeight = outputHeight; bool shrinkVertical = false; // just keep looping... while (true) { // make sure our test dictionary is empty testImagePlacement.Clear(); // try to pack the images into our current test size if (!TestPackingImages(testWidth, testHeight, testImagePlacement)) { // if that failed... // if we have no images in imagePlacement, i.e. we've never succeeded at PackImages, // show an error and return false since there is no way to fit the images into our // maximum size texture if (testWidth == 2048) goto test; if (imagePlacement.Count == 0) return false; // otherwise return true to use our last good results if (shrinkVertical) return true; shrinkVertical = true; testWidth += smallestWidth + padding + padding; testHeight += smallestHeight + padding + padding; continue; } test: // clear the imagePlacement dictionary and add our test results in imagePlacement.Clear(); foreach (var pair in testImagePlacement) imagePlacement.Add(pair.Key, pair.Value); // figure out the smallest bitmap that will hold all the images testWidth = testHeight = 0; foreach (var pair in imagePlacement) { testWidth = Math.Max(testWidth, pair.Value.Right); testHeight = Math.Max(testHeight, pair.Value.Bottom); } // subtract the extra padding on the right and bottom if (!shrinkVertical) testWidth -= padding; testHeight -= padding; // if we require a power of two texture, find the next power of two that can fit this image if (requirePow2) { testWidth = MiscHelper.FindNextPowerOfTwo(testWidth); testHeight = MiscHelper.FindNextPowerOfTwo(testHeight); } // if we require a square texture, set the width and height to the larger of the two if (requireSquare) { int max = Math.Max(testWidth, testHeight); testWidth = testHeight = max; } // if the test results are the same as our last output results, we've reached an optimal size, // so we can just be done if (testWidth == outputWidth && testHeight == outputHeight) { if (shrinkVertical) return true; shrinkVertical = true; } // save the test results as our last known good results outputWidth = testWidth; outputHeight = testHeight; // subtract the smallest image size out for the next test iteration if (!shrinkVertical) testWidth -= smallestWidth; testHeight -= smallestHeight; } }
public static void Main(string[] args) { string lexiconFile = null; string trainFile = null; string developmentFile = null; string modelFile = null; List <Dictionary> posDictionaries = new List <Dictionary>(); List <Embedding> posEmbeddings = new List <Embedding>(); List <Dictionary> neDictionaries = new List <Dictionary>(); List <Embedding> neEmbeddings = new List <Embedding>(); int posBeamSize = 8; int neBeamSize = 4; string language = null; bool preserve = false; bool plainOutput = false; string fold = null; int maximumPosIterations = 16; int maximumNeIterations = 16; bool extendLexicon = true; bool hasNe = true; for (int i = 0; i < args.Length; i++) { if (args[i].Equals("-lexicon")) { lexiconFile = args[++i]; } else if (args[i].Equals("-dict")) { string destination = args[++i]; Dictionary dictionary = new Dictionary(); try { dictionary.FromFile(args[++i]); } catch (IOException e) { Console.WriteLine("Can not load dictionary file."); Console.WriteLine(e.StackTrace); Environment.Exit(1); } if (destination.Equals("pos")) { posDictionaries.Add(dictionary); } else if (destination.Equals("ne")) { neDictionaries.Add(dictionary); } else if (destination.Equals("all")) { posDictionaries.Add(dictionary); neDictionaries.Add(dictionary); } else { Console.WriteLine("Expected pos/ne/all."); Environment.Exit(1); } } else if (args[i].Equals("-lang")) { language = args[++i]; } else if (args[i].Equals("-extendlexicon")) { extendLexicon = true; } else if (args[i].Equals("-noextendlexicon")) { extendLexicon = false; } else if (args[i].Equals("-noner")) { hasNe = false; } else if (args[i].Equals("-positers")) { maximumPosIterations = int.Parse(args[++i]); } else if (args[i].Equals("-neiters")) { maximumNeIterations = int.Parse(args[++i]); } else if (args[i].Equals("-posbeamsize")) { posBeamSize = int.Parse(args[++i]); } else if (args[i].Equals("-nebeamsize")) { neBeamSize = int.Parse(args[++i]); } else if (args[i].Equals("-preserve")) { preserve = true; } else if (args[i].Equals("-plain")) { plainOutput = true; } else if (args[i].Equals("-fold")) { fold = args[++i]; } else if (args[i].Equals("-embed")) { string destination = args[++i]; Embedding embedding = new Embedding(); try { embedding.FromFile(args[++i]); } catch (IOException e) { Console.WriteLine("Can not load embedding file."); Console.WriteLine(e.StackTrace); Environment.Exit(1); } if (destination.Equals("pos")) { posEmbeddings.Add(embedding); } else if (destination.Equals("ne")) { neEmbeddings.Add(embedding); } else if (destination.Equals("all")) { posEmbeddings.Add(embedding); neEmbeddings.Add(embedding); } else { Console.WriteLine("Expected pos/ne/all."); Environment.Exit(1); } } else if (args[i].Equals("-trainfile")) { trainFile = args[++i]; } else if (args[i].Equals("-devfile")) { developmentFile = args[++i]; } else if (args[i].Equals("-modelfile")) { modelFile = args[++i]; } else if (args[i].Equals("-train")) { TaggedToken[][] developmentSentences = null; if (trainFile == null || modelFile == null || language == null) { Console.WriteLine("Insufficient data."); Environment.Exit(1); } TaggedData taggedData = new TaggedData(language); TaggedToken[][] trainSentences = taggedData.ReadConll(trainFile, null, true, !trainFile.EndsWith(".conll")); if (developmentFile != null) { developmentSentences = taggedData.ReadConll(developmentFile, null, true, !developmentFile.EndsWith(".conll")); } Console.WriteLine($"Read {trainSentences.Length} training sentences and {developmentSentences?.Length ?? 0} development sentences."); Tagger tagger = GetTagger(language, taggedData, posBeamSize, neBeamSize); tagger.BuildLexicons(trainSentences); Lexicon lexicon = tagger.PosLexicon; Console.WriteLine($"POS lexicon size (corpus) {lexicon.Size}."); if (lexiconFile != null) { Console.WriteLine(extendLexicon ? $"Reading lexicon '{lexiconFile}'." : $"Reading lexicon (not extending profiles) '{lexiconFile}'."); lexicon.FromFile(lexiconFile, taggedData.PosTagSet, extendLexicon); Console.WriteLine($"POS lexicon size (external) {lexicon.Size}."); } tagger.PosDictionaries = posDictionaries; tagger.PosEmbeddings = posEmbeddings; tagger.NeDictionaries = neDictionaries; tagger.NeEmbeddings = neEmbeddings; tagger.MaximumPosIterations = maximumPosIterations; tagger.MaximumNeIterations = maximumNeIterations; tagger.Train(trainSentences, developmentSentences); BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(new FileStream(modelFile, FileMode.Create), tagger); } else if (args[i].Equals("-cross")) { TaggedData taggedData = new TaggedData(language); TaggedToken[][] allSentences = taggedData.ReadConll(trainFile, null, true, !trainFile.EndsWith(".conll")); Tagger tagger = GetTagger(language, taggedData, posBeamSize, neBeamSize); tagger.PosDictionaries = posDictionaries; tagger.PosEmbeddings = posEmbeddings; tagger.NeDictionaries = neDictionaries; tagger.NeEmbeddings = neEmbeddings; const int foldsCount = 10; Evaluation evaluation = new Evaluation(); for (int j = 0; j < foldsCount; j++) { Evaluation localEvaluation = new Evaluation(); TaggedToken[][][] parts = GetSUCFold(allSentences, j); Console.WriteLine($"Fold {j}, train ({parts[0].Length}), development ({parts[1].Length}), test ({parts[2].Length})"); Lexicon lexicon = tagger.PosLexicon; lexicon.Clear(); tagger.BuildLexicons(parts[0]); if (lexiconFile != null) { lexicon.FromFile(lexiconFile, taggedData.PosTagSet, extendLexicon); } tagger.Train(parts[0], parts[1]); foreach (TaggedToken[] sentence in parts[2]) { TaggedToken[] taggedSentence = tagger.TagSentence(sentence, true, false); evaluation.Evaluate(taggedSentence, sentence); localEvaluation.Evaluate(taggedSentence, sentence); tagger.TaggedData.WriteConllGold(new StreamWriter(Console.OpenStandardOutput()), taggedSentence, sentence, plainOutput); } Console.WriteLine($"Local POS accuracy: {localEvaluation.GetPosAccuracy()} ({localEvaluation.PosCorrect} / {localEvaluation.PosTotal})"); } Console.WriteLine($"POS accuracy: {evaluation.GetPosAccuracy()} ({evaluation.PosCorrect} / {evaluation.PosTotal})"); Console.WriteLine($"NE precision: {evaluation.GetNePrecision()}"); Console.WriteLine($"NE recall: {evaluation.GetNeRecall()}"); Console.WriteLine($"NE F-score: {evaluation.GetNeFScore()}"); Console.WriteLine($"NE total: {evaluation.NeTotal}"); Console.WriteLine($"NE correct: {evaluation.NeCorrect}"); Console.WriteLine($"NE found: {evaluation.NeFound}"); } else if (args[i].Equals("-server")) { if (modelFile == null || i >= args.Length - 1) { Console.WriteLine("Insufficient data."); Environment.Exit(1); } IPAddress serverIp = Dns.GetHostAddresses(args[++i]).FirstOrDefault(); int serverPort = int.Parse(args[++i]); BinaryFormatter formatter = new BinaryFormatter(); Console.WriteLine("Loading Stagger model ..."); Tagger tagger = (Tagger)formatter.Deserialize(new FileStream(modelFile, FileMode.Open)); language = tagger.TaggedData.Language; TcpListener tcpListener = new TcpListener(serverIp, serverPort); tcpListener.Start(4); while (true) { Socket sock = null; try { sock = tcpListener.AcceptSocket(); Console.WriteLine($"Connected to {sock.RemoteEndPoint}"); NetworkStream networkStream = new NetworkStream(sock); byte[] lengthBuffer = new byte[4]; if (networkStream.Read(lengthBuffer) != 4) { throw new IOException("Can not read length."); } int length = BitConverter.ToInt32(lengthBuffer); if (length < 1 || length > 100000) { throw new IOException($"Invalid data size {length}."); } byte[] dataBuf = new byte[length]; if (networkStream.Read(dataBuf) != length) { throw new IOException("Can not read data."); } StringReader reader = new StringReader(Encoding.UTF8.GetString(dataBuf)); StreamWriter writer = new StreamWriter(networkStream, Encoding.UTF8); Tokenizer tokenizer = GetTokenizer(reader, language); List <Token> sentence; int sentenceIndex = 0; string fileId = "net"; while ((sentence = tokenizer.ReadSentence()) != null) { TaggedToken[] taggedSentence = new TaggedToken[sentence.Count]; if (tokenizer.SentenceId != null) { if (!fileId.Equals(tokenizer.SentenceId)) { fileId = tokenizer.SentenceId; sentenceIndex = 0; } } for (int j = 0; j < sentence.Count; j++) { Token token = sentence[j]; var id = $"{fileId}:{sentenceIndex}:{token.Offset}"; taggedSentence[j] = new TaggedToken(token, id); } TaggedToken[] taggedSent = tagger.TagSentence(taggedSentence, true, false); tagger.TaggedData.WriteConllSentence(writer ?? new StreamWriter(Console.OpenStandardOutput()), taggedSent, plainOutput); sentenceIndex++; } tokenizer.Close(); if (sock.Connected) { Console.WriteLine($"Closing connection to {sock.RemoteEndPoint}."); writer.Close(); } } catch (IOException e) { Console.WriteLine(e.StackTrace); if (sock != null) { Console.WriteLine($"Connection failed to {sock.RemoteEndPoint}."); if (sock.Connected) { sock.Close(); } } } } } else if (args[i].Equals("-tag")) { if (modelFile == null || i >= args.Length - 1) { Console.WriteLine("Insufficient data."); Environment.Exit(1); } List <string> inputFiles = new List <string>(); for (i++; i < args.Length && !args[i].StartsWith("-"); i++) { inputFiles.Add(args[i]); } if (inputFiles.Count < 1) { Console.WriteLine("No files to tag."); Environment.Exit(1); } BinaryFormatter formatter = new BinaryFormatter(); Console.WriteLine("Loading Stagger model ..."); Tagger tagger = (Tagger)formatter.Deserialize(new FileStream(modelFile, FileMode.Open)); language = tagger.TaggedData.Language; tagger.ExtendLexicon = extendLexicon; if (!hasNe) { tagger.HasNe = false; } foreach (string inputFile in inputFiles) { if (!(inputFile.EndsWith(".txt") || inputFile.EndsWith(".txt.gz"))) { TaggedToken[][] inputSentence = tagger.TaggedData.ReadConll(inputFile, null, true, !inputFile.EndsWith(".conll")); Evaluation evaluation = new Evaluation(); int count = 0; StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(), Encoding.UTF8); foreach (TaggedToken[] sentence in inputSentence) { if (count % 100 == 0) { Console.WriteLine($"Tagging sentence number {count}.\r"); } count++; TaggedToken[] taggedSentence = tagger.TagSentence(sentence, true, preserve); evaluation.Evaluate(taggedSentence, sentence); tagger.TaggedData.WriteConllGold(writer, taggedSentence, sentence, plainOutput); } writer.Close(); Console.WriteLine($"Tagging sentence number {count}."); Console.WriteLine($"POS accuracy: {evaluation.GetPosAccuracy()} ({evaluation.PosCorrect} / {evaluation.PosTotal})."); Console.WriteLine($"NE precision: {evaluation.GetNePrecision()}."); Console.WriteLine($"NE recall: {evaluation.GetNeRecall()}."); Console.WriteLine($"NE F-score: {evaluation.GetNeFScore()}."); } else { string fileId = Path.GetFileNameWithoutExtension(inputFile); TextReader reader = OpenUtf8File(inputFile); StreamWriter writer; if (inputFiles.Count > 1) { string outputFile = $"{inputFile}{(plainOutput ? ".plain" : ".conll")}"; writer = new StreamWriter(new FileStream(outputFile, FileMode.Create), Encoding.UTF8); } else { writer = new StreamWriter(Console.OpenStandardOutput(), Encoding.UTF8); } Tokenizer tokenizer = GetTokenizer(reader, language); List <Token> sentence; int sentenceIndex = 0; while ((sentence = tokenizer.ReadSentence()) != null) { TaggedToken[] sent = new TaggedToken[sentence.Count]; if (tokenizer.SentenceId != null) { if (!fileId.Equals(tokenizer.SentenceId)) { fileId = tokenizer.SentenceId; sentenceIndex = 0; } } for (int j = 0; j < sentence.Count; j++) { Token tok = sentence[j]; var id = $"{fileId}:{sentenceIndex}:{tok.Offset}"; sent[j] = new TaggedToken(tok, id); } TaggedToken[] taggedSent = tagger.TagSentence(sent, true, false); tagger.TaggedData.WriteConllSentence(writer ?? new StreamWriter(Console.OpenStandardOutput()), taggedSent, plainOutput); sentenceIndex++; } tokenizer.Close(); writer?.Close(); } } } else if (args[i].Equals("-tokenize")) { string inputFile = args[++i]; TextReader reader = OpenUtf8File(inputFile); Tokenizer tokenizer = GetTokenizer(reader, language); List <Token> sentence; while ((sentence = tokenizer.ReadSentence()) != null) { if (sentence.Count == 0) { continue; } if (!plainOutput) { Console.Write(sentence[0].Value.Replace(' ', '_')); for (int j = 1; j < sentence.Count; j++) { Console.Write($" {sentence[j].Value.Replace(' ', '_')}"); } Console.WriteLine(""); } else { foreach (Token token in sentence) { Console.WriteLine(token.Value); } Console.WriteLine(); } } tokenizer.Close(); } } }
void KeyControl() { if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) { if (Input.GetKeyDown(KeyCode.Alpha3)) { lexicon.ChangePhrase(-3); } } if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { if (Input.GetKeyDown(KeyCode.RightArrow)) { server.Send("TouchScreen Keyboard Width", "+"); } if (Input.GetKeyDown(KeyCode.LeftArrow)) { server.Send("TouchScreen Keyboard Width", "-"); } if (Input.GetKeyDown(KeyCode.D)) { debugOn ^= true; info.Log("Debug", debugOn.ToString()); lexicon.SetDebugDisplay(debugOn); } if (Input.GetKeyDown(KeyCode.M)) { parameter.ChangeMode(); } if (Input.GetKeyDown(KeyCode.L)) { parameter.ChangeLocationFormula(); } if (Input.GetKeyDown(KeyCode.N)) { lexicon.ChangePhrase(); } if (Input.GetKeyDown(KeyCode.C)) { lexicon.ChangeCandidatesChoose(true); } if (Input.GetKeyDown(KeyCode.R)) { server.Send("Change Ratio", ""); server.Send("Get Keyboard Size", ""); } if (Input.GetKeyDown(KeyCode.T)) { parameter.ChangeRatio(); lexicon.CalcKeyLayout(); lexicon.CalcLexicon(); } if (Input.GetKeyDown(KeyCode.Alpha1)) { HideDisplay(); info.Clear(); if (Parameter.userStudy == Parameter.UserStudy.Basic) { Parameter.userStudy = Parameter.UserStudy.Study1_Train; lexicon.ChangePhrase(); textManager.HighLight(-100); info.Log("Phrase", "Warmup"); return; } Parameter.userStudy = Parameter.UserStudy.Study1; lexicon.ChangePhrase(phraseID); SendPhraseMessage(); textManager.HighLight(-100); info.Log("Phrase", (phraseID + 1).ToString() + "/40"); server.Send("Get Keyboard Size", ""); } if (Input.GetKeyDown(KeyCode.Alpha2)) { HideDisplay(); Parameter.userStudy = Parameter.UserStudy.Study2; lexicon.SetPhraseList(Parameter.userStudy); lexicon.ChangePhrase(phraseID); SendPhraseMessage(); info.Clear(); info.Log("Mode", Parameter.mode.ToString()); blockID = blockID % 4 + 1; info.Log("Block", blockID.ToString() + "/4"); info.Log("Phrase", (phraseID % 10 + 1).ToString() + "/10"); } } if (Input.GetKeyDown(KeyCode.UpArrow)) { if (Input.GetKey(KeyCode.E)) { parameter.ChangeEndOffset(0.1f); } if (Input.GetKey(KeyCode.R)) { parameter.ChangeRadius(0.1f); } if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { server.Send("TouchScreen Keyboard Height", "+"); } if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) { server.Send("TouchScreen Keyboard Size", "+"); server.Send("Get Keyboard Size", ""); } } if (Input.GetKeyDown(KeyCode.DownArrow)) { if (Input.GetKey(KeyCode.E)) { parameter.ChangeEndOffset(-0.1f); } if (Input.GetKey(KeyCode.R)) { parameter.ChangeRadius(-0.1f); } if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { server.Send("TouchScreen Keyboard Height", "-"); } if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) { server.Send("TouchScreen Keyboard Size", "-"); server.Send("Get Keyboard Size", ""); } } if (Input.GetKeyDown(KeyCode.Space)) { switch (Parameter.userStudy) { case Parameter.UserStudy.Basic: lexicon.ChangePhrase(); break; case Parameter.UserStudy.Study1_Train: lexicon.ChangePhrase(); textManager.HighLight(-100); break; case Parameter.UserStudy.Study1: if (!textManager.InputNumberCorrect() && !(Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))) { return; } server.Send("Study1 End Phrase", Parameter.mode.ToString()); phraseID++; if (phraseID % 10 == 0) { Parameter.userStudy = Parameter.UserStudy.Study1_Train; lexicon.ChangePhrase(); textManager.HighLight(-100); info.Log("Phrase", "<color=red>Rest</color>"); return; } lexicon.ChangePhrase(phraseID); SendPhraseMessage(); textManager.HighLight(-100); info.Log("Phrase", (phraseID + 1).ToString() + "/40"); break; case Parameter.UserStudy.Study2: if (!textManager.InputNumberCorrect() && !(Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))) { return; } FinishStudy2Phrase(); break; } } if (Input.GetKeyDown(KeyCode.Backspace)) { if (Parameter.userStudy == Parameter.UserStudy.Study1 || Parameter.userStudy == Parameter.UserStudy.Study2) { server.Send("Backspace", ""); } if (Parameter.userStudy == Parameter.UserStudy.Study1 || Parameter.userStudy == Parameter.UserStudy.Study1_Train) { textManager.HighLight(-100); } if (Parameter.userStudy == Parameter.UserStudy.Study2 || Parameter.userStudy == Parameter.UserStudy.Basic) { lexicon.Clear(); } } }
private void ParseText_DoWork(object sender, DoWorkEventArgs e) { Lexicon.Clear(); var expElementPattern = new Regex($"({PunctuationPattern.ToString()})|({WordPattern.ToString()})"); var whiteSpacePattern = new Regex(@"[\s\n\r]+", RegexOptions.Singleline | RegexOptions.Multiline); var worker = sender as BackgroundWorker; var text = e.Argument as string; int progress = 0; string state = string.Empty; // TODO: handling of paragraph breaks and section headers, etc foreach (Match p in ParagraphPattern.Matches(text)) { string paragraphText = p.Value.Trim(); paragraphText = whiteSpacePattern.Replace(paragraphText, " "); var paragraph = new Lx.Discourse(); Text.Discourse.AddLast(paragraph); foreach (Match l in LinePattern.Matches(paragraphText)) { //store line, section up into words and punctuation string cleanedLine = l.Value.Trim(); //cleanedLine = whiteSpacePattern.Replace(cleanedLine, " "); state = cleanedLine; var expression = new Lx.Expression(cleanedLine); paragraph.Expressions.AddLast(expression); foreach (Match m in expElementPattern.Matches(expression.Graph)) { if (m.Groups.Count > 0) { // string m => List<Glyphs> var glyphs = Script.AddGlyphs(m.Value.ToCharArray()); // List<Glyph> => List<Grapheme> // Pre-analysis, graphemes are 1:1 with glyphs var graphemes = Orthography.AddGraphemes(glyphs); // List<Grapheme> => Morpheme if (string.IsNullOrEmpty(m.Groups[1].Value)) { //var morph = Text.Lexicon.Add(m.Groups[2].Value); //morph.GraphemeChain.Add(Lx.SegmentChain<Lx.Grapheme>.NewSegmentChain(graphemes)); Lx.Morpheme morph = Text.Lexicon.Add(graphemes); expression.Sequence.AddLast(morph); } else { expression.Sequence.AddLast(Text.Paralexicon.Add(m.Groups[1].Value)); } } } worker.ReportProgress(++progress, state); } } UpdateLocalLexicon(); }
protected async void Page_Load() { HttpClient client = new HttpClient(); var doc = new HtmlAgilityPack.HtmlDocument(); var html = await client.GetStringAsync("http://ffxivhunt.com/" + FFXIV_Safari.Properties.Settings.Default.serverselect.ToLower()); doc.LoadHtml(html); if (this.InvokeRequired) { BlinkDelegate del = new BlinkDelegate(Page_Load); this.Invoke(del); } else { huntdata.Suspend(); elitemarksA.Clear(); elitemarksS.Clear(); finaloutputA.Clear(); finaloutputS.Clear(); huntdata.Clear(); elitemarksA.Add("Forneus", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][2]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][1]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_35']/span[@class='time']")[0].InnerText); elitemarksA.Add("Girtab", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][2]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][3]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_38']/span[@class='time']")[0].InnerText); elitemarksA.Add("Melt", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][2]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][2]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_5']/span[@class='time']")[0].InnerText); elitemarksA.Add("Ghede Ti Malice", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][2]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][4]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_32']/span[@class='time']")[0].InnerText); elitemarksS.Add("Laideronnette", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][2]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][1]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_36']/span[@class='time']")[0].InnerText); elitemarksS.Add("Thousand-cast Theda", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][2]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][3]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_39']/span[@class='time']")[0].InnerText); elitemarksS.Add("Wulgaru", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][2]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][2]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_6']/span[@class='time']")[0].InnerText); elitemarksS.Add("Mindflayer", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][2]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][4]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_33']/span[@class='time']")[0].InnerText); elitemarksA.Add("Sabotender Bailarina", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][3]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][1]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_50']/span[@class='time']")[0].InnerText); elitemarksA.Add("Alectyron", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][3]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][5]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_8']/span[@class='time']")[0].InnerText); elitemarksA.Add("Zanig'oh", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][3]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][4]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_44']/span[@class='time']")[0].InnerText); elitemarksA.Add("Dalvag's Final Flame", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][3]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][3]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_47']/span[@class='time']")[0].InnerText); elitemarksA.Add("Maahes", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][3]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][2]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_41']/span[@class='time']")[0].InnerText); elitemarksS.Add("Brontes", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][3]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][1]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_51']/span[@class='time']")[0].InnerText); elitemarksS.Add("Zona Seeker", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][3]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][5]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_9']/span[@class='time']")[0].InnerText); elitemarksS.Add("Nunyunuwi", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][3]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][4]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_45']/span[@class='time']")[0].InnerText); elitemarksS.Add("Minhocao", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][3]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][3]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_48']/span[@class='time']")[0].InnerText); elitemarksS.Add("Lampalagua", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][3]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][2]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_42']/span[@class='time']")[0].InnerText); elitemarksA.Add("Hellsclaw", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][1]/div[@class='panel panel-info']/table[@class='table table-condensed table-hover'][1]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_20']/span[@class='time']")[0].InnerText); elitemarksA.Add("Unktehi", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][1]/div[@class='panel panel-info']/table[@class='table table-condensed table-hover'][2]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_23']/span[@class='time']")[0].InnerText); elitemarksA.Add("Vogaal Ja", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][1]/div[@class='panel panel-info']/table[@class='table table-condensed table-hover'][3]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_17']/span[@class='time']")[0].InnerText); elitemarksA.Add("Cornu", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][1]/div[@class='panel panel-info']/table[@class='table table-condensed table-hover'][4]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_29']/span[@class='time']")[0].InnerText); elitemarksA.Add("Marberry", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][1]/div[@class='panel panel-info']/table[@class='table table-condensed table-hover'][5]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_26']/span[@class='time']")[0].InnerText); elitemarksA.Add("Nahn", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][1]/div[@class='panel panel-info']/table[@class='table table-condensed table-hover'][6]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_2']/span[@class='time']")[0].InnerText); elitemarksS.Add("Garlok", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][1]/div[@class='panel panel-info']/table[@class='table table-condensed table-hover'][1]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_21']/span[@class='time']")[0].InnerText); elitemarksS.Add("Croakadile", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][1]/div[@class='panel panel-info']/table[@class='table table-condensed table-hover'][2]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_24']/span[@class='time']")[0].InnerText); elitemarksS.Add("Croque-Mitaine", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][1]/div[@class='panel panel-info']/table[@class='table table-condensed table-hover'][3]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_18']/span[@class='time']")[0].InnerText); elitemarksS.Add("Mahisha", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][1]/div[@class='panel panel-info']/table[@class='table table-condensed table-hover'][4]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_30']/span[@class='time']")[0].InnerText); elitemarksS.Add("Nandi", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][1]/div[@class='panel panel-info']/table[@class='table table-condensed table-hover'][5]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_27']/span[@class='time']")[0].InnerText); elitemarksS.Add("Bonnacon", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][1]/div[@class='panel panel-info']/table[@class='table table-condensed table-hover'][6]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_3']/span[@class='time']")[0].InnerText); elitemarksA.Add("Mirka", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][2]/div[@class='panel panel-info'][2]/table[@class='table table-condensed table-hover'][2]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_53']/span[@class='time']")[0].InnerText); elitemarksA.Add("Lyuba", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][2]/div[@class='panel panel-info'][2]/table[@class='table table-condensed table-hover'][2]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_68']/span[@class='time']")[0].InnerText); elitemarksA.Add("Marraco", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][2]/div[@class='panel panel-info'][2]/table[@class='table table-condensed table-hover'][1]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_11']/span[@class='time']")[0].InnerText); elitemarksA.Add("Kurrea", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][3]/div[@class='panel panel-info'][2]/table[@class='table table-condensed table-hover']/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_14']/span[@class='time']")[0].InnerText); elitemarksS.Add("Kaiser Behemoth", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][2]/div[@class='panel panel-info'][2]/table[@class='table table-condensed table-hover'][2]/tbody/tr[@class='hot-toggle'][3]/td[@class='t140']/a[@id='mob_54']/span[@class='time']")[0].InnerText); elitemarksS.Add("Safat", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][2]/div[@class='panel panel-info'][2]/table[@class='table table-condensed table-hover'][1]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_12']/span[@class='time']")[0].InnerText); elitemarksS.Add("Agrippa the Mighty", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][3]/div[@class='panel panel-info'][2]/table[@class='table table-condensed table-hover']/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_15']/span[@class='time']")[0].InnerText); elitemarksA.Add("Pylraster", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][4]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][2]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_59']/span[@class='time']")[0].InnerText); elitemarksA.Add("Lord of the Wyverns", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][4]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][2]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_75']/span[@class='time']")[0].InnerText); elitemarksA.Add("Slipkinx Steeljoints", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][4]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][3]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_62']/span[@class='time']")[0].InnerText); elitemarksA.Add("Stolas", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][4]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][3]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_77']/span[@class='time']")[0].InnerText); elitemarksA.Add("Bune", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][4]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][1]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_65']/span[@class='time']")[0].InnerText); elitemarksA.Add("Agathos", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][4]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][1]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_81']/span[@class='time']")[0].InnerText); elitemarksS.Add("Senmurv", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][4]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][2]/tbody/tr[@class='hot-toggle'][3]/td[@class='t140']/a[@id='mob_60']/span[@class='time']")[0].InnerText); elitemarksS.Add("The Pale Rider", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][4]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][3]/tbody/tr[@class='hot-toggle'][3]/td[@class='t140']/a[@id='mob_63']/span[@class='time']")[0].InnerText); elitemarksS.Add("Gandarewa", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][4]/div[@class='panel panel-info'][1]/table[@class='table table-condensed table-hover'][1]/tbody/tr[@class='hot-toggle'][3]/td[@class='t140']/a[@id='mob_66']/span[@class='time']")[0].InnerText); elitemarksA.Add("Campacti", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][4]/div[@class='panel panel-info'][2]/table[@class='table table-condensed table-hover'][1]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_71']/span[@class='time']")[0].InnerText); elitemarksA.Add("Stench Blossom", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][4]/div[@class='panel panel-info'][2]/table[@class='table table-condensed table-hover'][1]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_72']/span[@class='time']")[0].InnerText); elitemarksA.Add("Enkelados", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][4]/div[@class='panel panel-info'][2]/table[@class='table table-condensed table-hover'][2]/tbody/tr[@class='hot-toggle'][1]/td[@class='t140']/a[@id='mob_56']/span[@class='time']")[0].InnerText); elitemarksA.Add("Sisiutl", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][4]/div[@class='panel panel-info'][2]/table[@class='table table-condensed table-hover'][2]/tbody/tr[@class='hot-toggle'][2]/td[@class='t140']/a[@id='mob_79']/span[@class='time']")[0].InnerText); elitemarksS.Add("Leucrotta", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][4]/div[@class='panel panel-info'][2]/table[@class='table table-condensed table-hover'][1]/tbody/tr[@class='hot-toggle'][3]/td[@class='t140']/a[@id='mob_73']/span[@class='time']")[0].InnerText); elitemarksS.Add("Bird of Paradise", doc.DocumentNode.SelectNodes("/html/body/div[@id='timer']/div[@class='row breath']/div[@class='col-md-3 col-sm-6'][4]/div[@class='panel panel-info'][2]/table[@class='table table-condensed table-hover'][2]/tbody/tr[@class='hot-toggle'][3]/td[@class='t140']/a[@id='mob_57']/span[@class='time']")[0].InnerText); printData(); } }