Last active
August 14, 2016 15:07
-
-
Save MNie/60c0ae7de329a09a342e780af11f3d56 to your computer and use it in GitHub Desktop.
Azure text analytics, sentiment, createjson
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type requestJson = | |
{ | |
documents: seq<document> | |
} | |
and document = | |
{ | |
language: string | |
id: string | |
text: string | |
} | |
let createJson (data:seq<CsvProvider<"input.csv">.Row>) = | |
{ | |
documents = data |> Seq.map ( fun x -> x.ToString()) |> Seq.mapi ( fun i x -> {language = "en"; id = i.ToString(); text = x}) | |
} | |
let saveJson (json, fileName: string) = | |
use outFile = new StreamWriter(fileName) | |
( | |
outFile.Write(JsonConvert.SerializeObject json) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment