Skip to content

Commit 5ed6886

Browse files
committed
feat(Discovery): Added tokenization methods
1 parent 862e57a commit 5ed6886

File tree

7 files changed

+498
-24
lines changed

7 files changed

+498
-24
lines changed

Scripts/Services/Discovery/v1/Discovery.cs

Lines changed: 307 additions & 24 deletions
Large diffs are not rendered by default.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Copyright 2018 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
using FullSerializer;
19+
using System.Collections.Generic;
20+
21+
namespace IBM.Watson.DeveloperCloud.Services.Discovery.v1
22+
{
23+
/// <summary>
24+
/// Tokenization dictionary describing how words are tokenized during ingestion and at query time.
25+
/// </summary>
26+
[fsObject]
27+
public class TokenDict
28+
{
29+
/// <summary>
30+
/// An array of tokenization rules. Each rule contains, the original `text` string, component `tokens`, any
31+
/// alternate character set `readings`, and which `part_of_speech` the text is from.
32+
/// </summary>
33+
[fsProperty("tokenization_rules")]
34+
public List<TokenDictRule> TokenizationRules { get; set; }
35+
}
36+
37+
}

Scripts/Services/Discovery/v1/Models/TokenDict.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* Copyright 2018 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
using FullSerializer;
19+
using System.Collections.Generic;
20+
21+
namespace IBM.Watson.DeveloperCloud.Services.Discovery.v1
22+
{
23+
/// <summary>
24+
/// An object defining a single tokenizaion rule.
25+
/// </summary>
26+
[fsObject]
27+
public class TokenDictRule
28+
{
29+
/// <summary>
30+
/// The string to tokenize.
31+
/// </summary>
32+
[fsProperty("text")]
33+
public string Text { get; set; }
34+
/// <summary>
35+
/// Array of tokens that the `text` field is split into when found.
36+
/// </summary>
37+
[fsProperty("tokens")]
38+
public List<string> Tokens { get; set; }
39+
/// <summary>
40+
/// Array of tokens that represent the content of the `text` field in an alternate character set.
41+
/// </summary>
42+
[fsProperty("readings")]
43+
public List<string> Readings { get; set; }
44+
/// <summary>
45+
/// The part of speech that the `text` string belongs to. For example `noun`. Custom parts of speech can be
46+
/// specified.
47+
/// </summary>
48+
[fsProperty("part_of_speech")]
49+
public string PartOfSpeech { get; set; }
50+
}
51+
52+
}

Scripts/Services/Discovery/v1/Models/TokenDictRule.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**
2+
* Copyright 2018 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
using FullSerializer;
19+
using System.Runtime.Serialization;
20+
21+
namespace IBM.Watson.DeveloperCloud.Services.Discovery.v1
22+
{
23+
/// <summary>
24+
/// Object describing the current status of the tokenization dictionary.
25+
/// </summary>
26+
[fsObject]
27+
public class TokenDictStatusResponse
28+
{
29+
/// <summary>
30+
/// Current tokenization dictionary status for the specified collection.
31+
/// </summary>
32+
/// <value>
33+
/// Current tokenization dictionary status for the specified collection.
34+
/// </value>
35+
public enum StatusEnum
36+
{
37+
38+
/// <summary>
39+
/// Enum ACTIVE for active
40+
/// </summary>
41+
[EnumMember(Value = "active")]
42+
ACTIVE,
43+
44+
/// <summary>
45+
/// Enum PENDING for pending
46+
/// </summary>
47+
[EnumMember(Value = "pending")]
48+
PENDING,
49+
50+
/// <summary>
51+
/// Enum NOT_FOUND for not found
52+
/// </summary>
53+
[EnumMember(Value = "not found")]
54+
NOT_FOUND
55+
}
56+
57+
/// <summary>
58+
/// Current tokenization dictionary status for the specified collection.
59+
/// </summary>
60+
[fsProperty("status")]
61+
public StatusEnum? Status { get; set; }
62+
/// <summary>
63+
/// The type for this dictionary. Always returns `tokenization_dictionary`.
64+
/// </summary>
65+
[fsProperty("type")]
66+
public string Type { get; set; }
67+
}
68+
69+
}

Scripts/Services/Discovery/v1/Models/TokenDictStatusResponse.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)