public void ParseAnkiStringWithVerb() { const string ankiStringWithNoun = @"<span style=""color: #aaa;"">(adj.)</span> to blame<br/><span style=""color: #666;"">/ˈmoʊʃənləs/</span><br/><br/>The landscape hung <b>motionless</b> below him.<br/>He felt a tiny lurch, evidence of the minutest lack of synchrony between the shutting down of the fusion rockets and the drives, but then all was <b>motionless</b>.<br/>The figure was crouched down by the shore of sea, <b>motionless</b>, as if caught in some reverie that had interrupted an otherwise innocent examination of the tide pools and their fauna. неподвижный"; var parser = new AnkiStringParser(); var wordInfo = parser.ParseString(ankiStringWithNoun); wordInfo.Should().NotBeNull(); wordInfo.PlainWord.Should().Be("blame"); }
private static void Main([NotNull] string[] args) { if(args.Length != 1) { Console.WriteLine("Usage:"); Console.WriteLine(" AnkiLovesGoogle.exe {anki_output_file}"); return; } var ankiStringParser = new AnkiStringParser(); var googleTranslateApi = new GoogleTranslateApi(); File.WriteAllLines( GetOutputFileName(args[0]), File .ReadAllLines(args[0]) .Select(ankiStringParser.ParseString) .Select(x => new AnkiCard(x.Front, FormatGoogleDefinitions(googleTranslateApi.GetDefinitions(x.PlainWord)))) .Select(x => x.FormatAsString()) ); }