Skip to content

Instantly share code, notes, and snippets.

@jamesmontemagno
Created February 5, 2018 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmontemagno/65e90515fb25e48c574d0b7b381fde65 to your computer and use it in GitHub Desktop.
Save jamesmontemagno/65e90515fb25e48c574d0b7b381fde65 to your computer and use it in GitHub Desktop.
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
// using QuickType;
//
// var data = TextAnalytics.FromJson(jsonString);
namespace QuickType
{
using System;
using System.Net;
using System.Collections.Generic;
using Newtonsoft.Json;
public partial class TextAnalytics
{
[JsonProperty("languageDetection")]
public LanguageDetection LanguageDetection { get; set; }
[JsonProperty("keyPhrases")]
public KeyPhrases KeyPhrases { get; set; }
[JsonProperty("sentiment")]
public Sentiment Sentiment { get; set; }
}
public partial class KeyPhrases
{
[JsonProperty("documents")]
public KeyPhrasesDocument[] Documents { get; set; }
[JsonProperty("errors")]
public object[] Errors { get; set; }
}
public partial class KeyPhrasesDocument
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("keyPhrases")]
public string[] KeyPhrases { get; set; }
}
public partial class LanguageDetection
{
[JsonProperty("documents")]
public LanguageDetectionDocument[] Documents { get; set; }
[JsonProperty("errors")]
public object[] Errors { get; set; }
}
public partial class LanguageDetectionDocument
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("detectedLanguages")]
public DetectedLanguage[] DetectedLanguages { get; set; }
}
public partial class DetectedLanguage
{
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("iso6391Name")]
public string Iso6391Name { get; set; }
[JsonProperty("score")]
public double Score { get; set; }
}
public partial class Sentiment
{
[JsonProperty("documents")]
public SentimentDocument[] Documents { get; set; }
[JsonProperty("errors")]
public object[] Errors { get; set; }
}
public partial class SentimentDocument
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("score")]
public double Score { get; set; }
}
public partial class TextAnalytics
{
public static TextAnalytics FromJson(string json) => JsonConvert.DeserializeObject<TextAnalytics>(json, Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this TextAnalytics self) => JsonConvert.SerializeObject(self, Converter.Settings);
}
public class Converter
{
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
{
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
DateParseHandling = DateParseHandling.None,
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment