public void TestWordDefinitions()
 {
     var googleTranslateApi = new GoogleTranslateApi();
     var definitions = googleTranslateApi.GetDefinitions("blame");
     definitions.Should().NotBeNull();
     definitions["verb"].Should().ContainSingle().Which.Should().Be("assign responsibility for a fault or wrong.");
     definitions["noun"].Should().ContainSingle().Which.Should().Be("responsibility for a fault or wrong.");
 }
예제 #2
0
 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())
         );
 }