forked from rosette-api/csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmorphology_compound-components.cs
More file actions
48 lines (46 loc) · 1.84 KB
/
morphology_compound-components.cs
File metadata and controls
48 lines (46 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
using rosette_api;
namespace rosette_apiExamples
{
class morphology_compound_components
{
/// <summary>
/// Example code to call Rosette API to get de-compounded words from a piece of text.
/// Requires Nuget Package:
/// rosette_api
/// </summary>
static void Main(string[] args)
{
//To use the C# API, you must provide an API key
string apikey = "Your API key";
string alturl = string.Empty;
//You may set the API key via command line argument:
//morphology_compound_components yourapikeyhere
if (args.Length != 0)
{
apikey = args[0];
alturl = args.Length > 1 ? args[1] : string.Empty;
}
try
{
CAPI MorphologyCAPI = string.IsNullOrEmpty(alturl) ? new CAPI(apikey) : new CAPI(apikey, alturl);
string morphology_compound_components_data = @"Rechtsschutzversicherungsgesellschaften";
//The results of the API call will come back in the form of a Dictionary
RosetteResponse response = MorphologyCAPI.Morphology(morphology_compound_components_data, null, null, null, MorphologyFeature.compoundComponents);
foreach (KeyValuePair<string, string> h in response.Headers) {
Console.WriteLine(string.Format("{0}:{1}", h.Key, h.Value));
}
Console.WriteLine(response.ContentAsJson);
}
catch (Exception e)
{
Console.WriteLine("Exception: " + e.Message);
}
}
}
}