Search is not available for this dataset
hexsha
stringlengths 40
40
| repo
stringlengths 6
126
| path
stringlengths 6
1.02k
| license
sequence | language
stringclasses 1
value | identifier
stringlengths 1
220
| return_type
stringlengths 1
110
⌀ | original_string
stringlengths 39
223k
| original_docstring
stringlengths 16
34.8k
| docstring
stringlengths 11
3.41k
| docstring_tokens
sequence | code
stringlengths 26
223k
| code_tokens
sequence | short_docstring
stringlengths 0
3.02k
| short_docstring_tokens
sequence | comment
sequence | parameters
list | docstring_params
dict | input_ids
sequence | attention_mask
sequence | labels
sequence |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d633c7a63514092743d35b3bfa64f284991a73e9 | BenFheng/main | src/test/java/seedu/expensela/storage/JsonExpenseLaStorageTest.java | [
"MIT"
] | Java | saveExpenseLa | null | private void saveExpenseLa(ReadOnlyExpenseLa expenseLa, String filePath) {
try {
new JsonExpenseLaStorage(Paths.get(filePath))
.saveExpenseLa(expenseLa, addToTestDataPathIfNotNull(filePath));
} catch (IOException ioe) {
throw new AssertionError("There should not be an error writing to the file.", ioe);
}
} | /**
* Saves {@code expenseLa} at the specified {@code filePath}.
*/ | Saves expenseLa at the specified filePath. | [
"Saves",
"expenseLa",
"at",
"the",
"specified",
"filePath",
"."
] | private void saveExpenseLa(ReadOnlyExpenseLa expenseLa, String filePath) {
try {
new JsonExpenseLaStorage(Paths.get(filePath))
.saveExpenseLa(expenseLa, addToTestDataPathIfNotNull(filePath));
} catch (IOException ioe) {
throw new AssertionError("There should not be an error writing to the file.", ioe);
}
} | [
"private",
"void",
"saveExpenseLa",
"(",
"ReadOnlyExpenseLa",
"expenseLa",
",",
"String",
"filePath",
")",
"{",
"try",
"{",
"new",
"JsonExpenseLaStorage",
"(",
"Paths",
".",
"get",
"(",
"filePath",
")",
")",
".",
"saveExpenseLa",
"(",
"expenseLa",
",",
"addToTestDataPathIfNotNull",
"(",
"filePath",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"AssertionError",
"(",
"\"There should not be an error writing to the file.\"",
",",
"ioe",
")",
";",
"}",
"}"
] | Saves {@code expenseLa} at the specified {@code filePath}. | [
"Saves",
"{",
"@code",
"expenseLa",
"}",
"at",
"the",
"specified",
"{",
"@code",
"filePath",
"}",
"."
] | [] | [
{
"param": "expenseLa",
"type": "ReadOnlyExpenseLa"
},
{
"param": "filePath",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "expenseLa",
"type": "ReadOnlyExpenseLa",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filePath",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
918,
1923,
424,
1907,
307,
30745,
12,
12066,
424,
1907,
307,
30745,
1329,
3558,
30745,
16,
514,
4612,
13,
288,
203,
3639,
775,
288,
203,
5411,
394,
3424,
424,
1907,
307,
30745,
3245,
12,
4466,
18,
588,
12,
22787,
3719,
203,
10792,
263,
5688,
424,
1907,
307,
30745,
12,
338,
1907,
307,
30745,
16,
9604,
4709,
751,
743,
2047,
5962,
12,
22787,
10019,
203,
3639,
289,
1044,
261,
14106,
10847,
13,
288,
203,
5411,
604,
394,
12068,
2932,
9828,
1410,
486,
506,
392,
555,
7410,
358,
326,
585,
1199,
16,
10847,
1769,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
348,
6606,
8901,
710,
1329,
3558,
30745,
97,
622,
326,
1269,
8901,
710,
4612,
5496,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
bbe292d04fdaef146fa19f867eaca91b5ac87db8 | BenFheng/main | src/main/java/seedu/expensela/model/transaction/Transaction.java | [
"MIT"
] | Java | isSameTransaction | null | public boolean isSameTransaction(Transaction otherTransaction) {
if (otherTransaction == this) {
return true;
}
return otherTransaction != null
&& otherTransaction.getName().equals(getName())
&& otherTransaction.getAmount().equals(getAmount())
&& otherTransaction.getDate().equals(getDate())
&& otherTransaction.getRemark().equals(getRemark())
&& otherTransaction.getCategory().equals(getCategory());
} | /**
* Returns true if both transactions of the same name have at least one other identity field that is the same.
* This defines a weaker notion of equality between two transactions.
*/ | Returns true if both transactions of the same name have at least one other identity field that is the same.
This defines a weaker notion of equality between two transactions. | [
"Returns",
"true",
"if",
"both",
"transactions",
"of",
"the",
"same",
"name",
"have",
"at",
"least",
"one",
"other",
"identity",
"field",
"that",
"is",
"the",
"same",
".",
"This",
"defines",
"a",
"weaker",
"notion",
"of",
"equality",
"between",
"two",
"transactions",
"."
] | public boolean isSameTransaction(Transaction otherTransaction) {
if (otherTransaction == this) {
return true;
}
return otherTransaction != null
&& otherTransaction.getName().equals(getName())
&& otherTransaction.getAmount().equals(getAmount())
&& otherTransaction.getDate().equals(getDate())
&& otherTransaction.getRemark().equals(getRemark())
&& otherTransaction.getCategory().equals(getCategory());
} | [
"public",
"boolean",
"isSameTransaction",
"(",
"Transaction",
"otherTransaction",
")",
"{",
"if",
"(",
"otherTransaction",
"==",
"this",
")",
"{",
"return",
"true",
";",
"}",
"return",
"otherTransaction",
"!=",
"null",
"&&",
"otherTransaction",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"getName",
"(",
")",
")",
"&&",
"otherTransaction",
".",
"getAmount",
"(",
")",
".",
"equals",
"(",
"getAmount",
"(",
")",
")",
"&&",
"otherTransaction",
".",
"getDate",
"(",
")",
".",
"equals",
"(",
"getDate",
"(",
")",
")",
"&&",
"otherTransaction",
".",
"getRemark",
"(",
")",
".",
"equals",
"(",
"getRemark",
"(",
")",
")",
"&&",
"otherTransaction",
".",
"getCategory",
"(",
")",
".",
"equals",
"(",
"getCategory",
"(",
")",
")",
";",
"}"
] | Returns true if both transactions of the same name have at least one other identity field that is the same. | [
"Returns",
"true",
"if",
"both",
"transactions",
"of",
"the",
"same",
"name",
"have",
"at",
"least",
"one",
"other",
"identity",
"field",
"that",
"is",
"the",
"same",
"."
] | [] | [
{
"param": "otherTransaction",
"type": "Transaction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "otherTransaction",
"type": "Transaction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
1250,
23061,
3342,
12,
3342,
1308,
3342,
13,
288,
203,
3639,
309,
261,
3011,
3342,
422,
333,
13,
288,
203,
5411,
327,
638,
31,
203,
3639,
289,
203,
203,
3639,
327,
1308,
3342,
480,
446,
203,
7734,
597,
1308,
3342,
18,
17994,
7675,
14963,
12,
17994,
10756,
203,
7734,
597,
1308,
3342,
18,
588,
6275,
7675,
14963,
12,
588,
6275,
10756,
203,
7734,
597,
1308,
3342,
18,
588,
1626,
7675,
14963,
12,
588,
1626,
10756,
203,
7734,
597,
1308,
3342,
18,
588,
1933,
1313,
7675,
14963,
12,
588,
1933,
1313,
10756,
203,
7734,
597,
1308,
3342,
18,
588,
4457,
7675,
14963,
12,
588,
4457,
10663,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2860,
638,
309,
3937,
8938,
434,
326,
1967,
508,
1240,
622,
4520,
1245,
1308,
4215,
652,
716,
353,
326,
1967,
18,
203,
377,
380,
1220,
11164,
279,
732,
6388,
486,
285,
434,
14958,
3086,
2795,
8938,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
831518365e88827bfcd4887b11bb278cf6be728c | BenFheng/main | src/main/java/seedu/expensela/logic/commands/EditCommand.java | [
"MIT"
] | Java | createEditedTransaction | Transaction | private static Transaction createEditedTransaction(Transaction transactionToEdit,
EditTransactionDescriptor editTransactionDescriptor) {
assert transactionToEdit != null;
Name updatedName = editTransactionDescriptor.getName().orElse(transactionToEdit.getName());
Amount updatedAmount = editTransactionDescriptor.getAmount().orElse(transactionToEdit.getAmount());
Date updatedDate = editTransactionDescriptor.getDate().orElse(transactionToEdit.getDate());
Remark updatedRemark = editTransactionDescriptor.getRemark().orElse(transactionToEdit.getRemark());
Category updatedCategory = editTransactionDescriptor.getCategory().orElse(transactionToEdit.getCategory());
return new Transaction(updatedName, updatedAmount, updatedDate, updatedRemark, updatedCategory);
} | /**
* Creates and returns a {@code Transaction} with the details of {@code transactionToEdit}
* edited with {@code editTransactionDescriptor}.
*/ | Creates and returns a Transaction with the details of transactionToEdit
edited with editTransactionDescriptor. | [
"Creates",
"and",
"returns",
"a",
"Transaction",
"with",
"the",
"details",
"of",
"transactionToEdit",
"edited",
"with",
"editTransactionDescriptor",
"."
] | private static Transaction createEditedTransaction(Transaction transactionToEdit,
EditTransactionDescriptor editTransactionDescriptor) {
assert transactionToEdit != null;
Name updatedName = editTransactionDescriptor.getName().orElse(transactionToEdit.getName());
Amount updatedAmount = editTransactionDescriptor.getAmount().orElse(transactionToEdit.getAmount());
Date updatedDate = editTransactionDescriptor.getDate().orElse(transactionToEdit.getDate());
Remark updatedRemark = editTransactionDescriptor.getRemark().orElse(transactionToEdit.getRemark());
Category updatedCategory = editTransactionDescriptor.getCategory().orElse(transactionToEdit.getCategory());
return new Transaction(updatedName, updatedAmount, updatedDate, updatedRemark, updatedCategory);
} | [
"private",
"static",
"Transaction",
"createEditedTransaction",
"(",
"Transaction",
"transactionToEdit",
",",
"EditTransactionDescriptor",
"editTransactionDescriptor",
")",
"{",
"assert",
"transactionToEdit",
"!=",
"null",
";",
"Name",
"updatedName",
"=",
"editTransactionDescriptor",
".",
"getName",
"(",
")",
".",
"orElse",
"(",
"transactionToEdit",
".",
"getName",
"(",
")",
")",
";",
"Amount",
"updatedAmount",
"=",
"editTransactionDescriptor",
".",
"getAmount",
"(",
")",
".",
"orElse",
"(",
"transactionToEdit",
".",
"getAmount",
"(",
")",
")",
";",
"Date",
"updatedDate",
"=",
"editTransactionDescriptor",
".",
"getDate",
"(",
")",
".",
"orElse",
"(",
"transactionToEdit",
".",
"getDate",
"(",
")",
")",
";",
"Remark",
"updatedRemark",
"=",
"editTransactionDescriptor",
".",
"getRemark",
"(",
")",
".",
"orElse",
"(",
"transactionToEdit",
".",
"getRemark",
"(",
")",
")",
";",
"Category",
"updatedCategory",
"=",
"editTransactionDescriptor",
".",
"getCategory",
"(",
")",
".",
"orElse",
"(",
"transactionToEdit",
".",
"getCategory",
"(",
")",
")",
";",
"return",
"new",
"Transaction",
"(",
"updatedName",
",",
"updatedAmount",
",",
"updatedDate",
",",
"updatedRemark",
",",
"updatedCategory",
")",
";",
"}"
] | Creates and returns a {@code Transaction} with the details of {@code transactionToEdit}
edited with {@code editTransactionDescriptor}. | [
"Creates",
"and",
"returns",
"a",
"{",
"@code",
"Transaction",
"}",
"with",
"the",
"details",
"of",
"{",
"@code",
"transactionToEdit",
"}",
"edited",
"with",
"{",
"@code",
"editTransactionDescriptor",
"}",
"."
] | [] | [
{
"param": "transactionToEdit",
"type": "Transaction"
},
{
"param": "editTransactionDescriptor",
"type": "EditTransactionDescriptor"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "transactionToEdit",
"type": "Transaction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "editTransactionDescriptor",
"type": "EditTransactionDescriptor",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
760,
5947,
752,
4666,
329,
3342,
12,
3342,
2492,
774,
4666,
16,
203,
4766,
5375,
15328,
3342,
3187,
3874,
3342,
3187,
13,
288,
203,
3639,
1815,
2492,
774,
4666,
480,
446,
31,
203,
203,
3639,
1770,
3526,
461,
273,
3874,
3342,
3187,
18,
17994,
7675,
280,
12427,
12,
7958,
774,
4666,
18,
17994,
10663,
203,
3639,
16811,
3526,
6275,
273,
3874,
3342,
3187,
18,
588,
6275,
7675,
280,
12427,
12,
7958,
774,
4666,
18,
588,
6275,
10663,
203,
3639,
2167,
3526,
1626,
273,
3874,
3342,
3187,
18,
588,
1626,
7675,
280,
12427,
12,
7958,
774,
4666,
18,
588,
1626,
10663,
203,
3639,
2663,
1313,
3526,
1933,
1313,
273,
3874,
3342,
3187,
18,
588,
1933,
1313,
7675,
280,
12427,
12,
7958,
774,
4666,
18,
588,
1933,
1313,
10663,
203,
3639,
9856,
3526,
4457,
273,
3874,
3342,
3187,
18,
588,
4457,
7675,
280,
12427,
12,
7958,
774,
4666,
18,
588,
4457,
10663,
203,
203,
3639,
327,
394,
5947,
12,
7007,
461,
16,
3526,
6275,
16,
3526,
1626,
16,
3526,
1933,
1313,
16,
3526,
4457,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
10210,
471,
1135,
279,
8901,
710,
5947,
97,
598,
326,
3189,
434,
8901,
710,
2492,
774,
4666,
97,
203,
377,
380,
18532,
598,
8901,
710,
3874,
3342,
3187,
5496,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
ef3087863615da351117198c11f85eadbc3a1d62 | BenFheng/main | src/main/java/seedu/expensela/storage/JsonAdaptedTransaction.java | [
"MIT"
] | Java | toModelType | Transaction | public Transaction toModelType() throws IllegalValueException {
if (name == null) {
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Name.class.getSimpleName()));
}
if (!Name.isValidName(name)) {
throw new IllegalValueException(Name.MESSAGE_CONSTRAINTS);
}
final Name modelName = new Name(name);
if (amount == null) {
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Amount.class.getSimpleName()));
}
if (!Amount.isValidAmount(amount)) {
throw new IllegalValueException(Amount.MESSAGE_CONSTRAINTS);
}
final Amount modelAmount = new Amount(amount, Boolean.valueOf(positive));
if (date == null) {
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Date.class.getSimpleName()));
}
if (!Date.isValidDate(date)) {
throw new IllegalValueException(Date.MESSAGE_CONSTRAINTS);
}
final Date modelDate = new Date(date);
if (remark == null) {
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Remark.class.getSimpleName()));
}
if (!Remark.isValidRemark(remark)) {
throw new IllegalValueException(Remark.MESSAGE_CONSTRAINTS);
}
final Remark modelRemark = new Remark(remark);
if (category == null) {
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT,
Category.class.getSimpleName()));
}
if (!Category.isValidCategory(category)) {
throw new IllegalValueException(Category.MESSAGE_CONSTRAINTS);
}
final Category modelCategory = new Category(category);
return new Transaction(modelName, modelAmount, modelDate, modelRemark, modelCategory);
} | /**
* Converts this Jackson-friendly adapted transaction object into the model's {@code Transaction} object.
*
* @throws IllegalValueException if there were any data constraints violated in the adapted transaction.
*/ | Converts this Jackson-friendly adapted transaction object into the model's Transaction object.
@throws IllegalValueException if there were any data constraints violated in the adapted transaction. | [
"Converts",
"this",
"Jackson",
"-",
"friendly",
"adapted",
"transaction",
"object",
"into",
"the",
"model",
"'",
"s",
"Transaction",
"object",
".",
"@throws",
"IllegalValueException",
"if",
"there",
"were",
"any",
"data",
"constraints",
"violated",
"in",
"the",
"adapted",
"transaction",
"."
] | public Transaction toModelType() throws IllegalValueException {
if (name == null) {
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Name.class.getSimpleName()));
}
if (!Name.isValidName(name)) {
throw new IllegalValueException(Name.MESSAGE_CONSTRAINTS);
}
final Name modelName = new Name(name);
if (amount == null) {
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Amount.class.getSimpleName()));
}
if (!Amount.isValidAmount(amount)) {
throw new IllegalValueException(Amount.MESSAGE_CONSTRAINTS);
}
final Amount modelAmount = new Amount(amount, Boolean.valueOf(positive));
if (date == null) {
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Date.class.getSimpleName()));
}
if (!Date.isValidDate(date)) {
throw new IllegalValueException(Date.MESSAGE_CONSTRAINTS);
}
final Date modelDate = new Date(date);
if (remark == null) {
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Remark.class.getSimpleName()));
}
if (!Remark.isValidRemark(remark)) {
throw new IllegalValueException(Remark.MESSAGE_CONSTRAINTS);
}
final Remark modelRemark = new Remark(remark);
if (category == null) {
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT,
Category.class.getSimpleName()));
}
if (!Category.isValidCategory(category)) {
throw new IllegalValueException(Category.MESSAGE_CONSTRAINTS);
}
final Category modelCategory = new Category(category);
return new Transaction(modelName, modelAmount, modelDate, modelRemark, modelCategory);
} | [
"public",
"Transaction",
"toModelType",
"(",
")",
"throws",
"IllegalValueException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalValueException",
"(",
"String",
".",
"format",
"(",
"MISSING_FIELD_MESSAGE_FORMAT",
",",
"Name",
".",
"class",
".",
"getSimpleName",
"(",
")",
")",
")",
";",
"}",
"if",
"(",
"!",
"Name",
".",
"isValidName",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"IllegalValueException",
"(",
"Name",
".",
"MESSAGE_CONSTRAINTS",
")",
";",
"}",
"final",
"Name",
"modelName",
"=",
"new",
"Name",
"(",
"name",
")",
";",
"if",
"(",
"amount",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalValueException",
"(",
"String",
".",
"format",
"(",
"MISSING_FIELD_MESSAGE_FORMAT",
",",
"Amount",
".",
"class",
".",
"getSimpleName",
"(",
")",
")",
")",
";",
"}",
"if",
"(",
"!",
"Amount",
".",
"isValidAmount",
"(",
"amount",
")",
")",
"{",
"throw",
"new",
"IllegalValueException",
"(",
"Amount",
".",
"MESSAGE_CONSTRAINTS",
")",
";",
"}",
"final",
"Amount",
"modelAmount",
"=",
"new",
"Amount",
"(",
"amount",
",",
"Boolean",
".",
"valueOf",
"(",
"positive",
")",
")",
";",
"if",
"(",
"date",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalValueException",
"(",
"String",
".",
"format",
"(",
"MISSING_FIELD_MESSAGE_FORMAT",
",",
"Date",
".",
"class",
".",
"getSimpleName",
"(",
")",
")",
")",
";",
"}",
"if",
"(",
"!",
"Date",
".",
"isValidDate",
"(",
"date",
")",
")",
"{",
"throw",
"new",
"IllegalValueException",
"(",
"Date",
".",
"MESSAGE_CONSTRAINTS",
")",
";",
"}",
"final",
"Date",
"modelDate",
"=",
"new",
"Date",
"(",
"date",
")",
";",
"if",
"(",
"remark",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalValueException",
"(",
"String",
".",
"format",
"(",
"MISSING_FIELD_MESSAGE_FORMAT",
",",
"Remark",
".",
"class",
".",
"getSimpleName",
"(",
")",
")",
")",
";",
"}",
"if",
"(",
"!",
"Remark",
".",
"isValidRemark",
"(",
"remark",
")",
")",
"{",
"throw",
"new",
"IllegalValueException",
"(",
"Remark",
".",
"MESSAGE_CONSTRAINTS",
")",
";",
"}",
"final",
"Remark",
"modelRemark",
"=",
"new",
"Remark",
"(",
"remark",
")",
";",
"if",
"(",
"category",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalValueException",
"(",
"String",
".",
"format",
"(",
"MISSING_FIELD_MESSAGE_FORMAT",
",",
"Category",
".",
"class",
".",
"getSimpleName",
"(",
")",
")",
")",
";",
"}",
"if",
"(",
"!",
"Category",
".",
"isValidCategory",
"(",
"category",
")",
")",
"{",
"throw",
"new",
"IllegalValueException",
"(",
"Category",
".",
"MESSAGE_CONSTRAINTS",
")",
";",
"}",
"final",
"Category",
"modelCategory",
"=",
"new",
"Category",
"(",
"category",
")",
";",
"return",
"new",
"Transaction",
"(",
"modelName",
",",
"modelAmount",
",",
"modelDate",
",",
"modelRemark",
",",
"modelCategory",
")",
";",
"}"
] | Converts this Jackson-friendly adapted transaction object into the model's {@code Transaction} object. | [
"Converts",
"this",
"Jackson",
"-",
"friendly",
"adapted",
"transaction",
"object",
"into",
"the",
"model",
"'",
"s",
"{",
"@code",
"Transaction",
"}",
"object",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
5947,
358,
1488,
559,
1435,
1216,
2141,
9738,
288,
203,
203,
3639,
309,
261,
529,
422,
446,
13,
288,
203,
5411,
604,
394,
2141,
9738,
12,
780,
18,
2139,
12,
19466,
67,
6776,
67,
8723,
67,
7254,
16,
1770,
18,
1106,
18,
588,
5784,
461,
1435,
10019,
203,
3639,
289,
203,
3639,
309,
16051,
461,
18,
26810,
461,
12,
529,
3719,
288,
203,
5411,
604,
394,
2141,
9738,
12,
461,
18,
8723,
67,
15199,
55,
1769,
203,
3639,
289,
203,
3639,
727,
1770,
12052,
273,
394,
1770,
12,
529,
1769,
203,
203,
3639,
309,
261,
8949,
422,
446,
13,
288,
203,
5411,
604,
394,
2141,
9738,
12,
780,
18,
2139,
12,
19466,
67,
6776,
67,
8723,
67,
7254,
16,
16811,
18,
1106,
18,
588,
5784,
461,
1435,
10019,
203,
3639,
289,
203,
3639,
309,
16051,
6275,
18,
26810,
6275,
12,
8949,
3719,
288,
203,
5411,
604,
394,
2141,
9738,
12,
6275,
18,
8723,
67,
15199,
55,
1769,
203,
3639,
289,
203,
3639,
727,
16811,
938,
6275,
273,
394,
16811,
12,
8949,
16,
3411,
18,
1132,
951,
12,
21094,
10019,
203,
203,
3639,
309,
261,
712,
422,
446,
13,
288,
203,
5411,
604,
394,
2141,
9738,
12,
780,
18,
2139,
12,
19466,
67,
6776,
67,
8723,
67,
7254,
16,
2167,
18,
1106,
18,
588,
5784,
461,
1435,
10019,
203,
3639,
289,
203,
3639,
309,
16051,
1626,
18,
26810,
1626,
12,
712,
3719,
288,
203,
5411,
604,
394,
2141,
9738,
12,
1626,
18,
8723,
67,
15199,
55,
1769,
203,
3639,
289,
203,
3639,
727,
2167,
938,
1626,
273,
394,
2167,
12,
712,
1769,
203,
203,
3639,
309,
261,
2764,
1313,
422,
446,
13,
288,
203,
5411,
604,
394,
2141,
9738,
12,
780,
18,
2139,
12,
19466,
67,
6776,
67,
8723,
67,
7254,
16,
2663,
1313,
18,
1106,
18,
588,
5784,
461,
1435,
10019,
203,
3639,
289,
203,
3639,
309,
16051,
1933,
1313,
18,
26810,
1933,
1313,
12,
2764,
1313,
3719,
288,
203,
5411,
604,
394,
2141,
9738,
12,
1933,
1313,
18,
8723,
67,
15199,
55,
1769,
203,
3639,
289,
203,
3639,
727,
2663,
1313,
938,
1933,
1313,
273,
394,
2663,
1313,
12,
2764,
1313,
1769,
203,
203,
3639,
309,
261,
4743,
422,
446,
13,
288,
203,
5411,
604,
394,
2141,
9738,
12,
780,
18,
2139,
12,
19466,
67,
6776,
67,
8723,
67,
7254,
16,
203,
10792,
9856,
18,
1106,
18,
588,
5784,
461,
1435,
10019,
203,
3639,
289,
203,
3639,
309,
16051,
4457,
18,
26810,
4457,
12,
4743,
3719,
288,
203,
5411,
604,
394,
2141,
9738,
12,
4457,
18,
8723,
67,
15199,
55,
1769,
203,
3639,
289,
203,
3639,
727,
9856,
938,
4457,
273,
394,
9856,
12,
4743,
1769,
203,
203,
3639,
327,
394,
5947,
12,
2284,
461,
16,
938,
6275,
16,
938,
1626,
16,
938,
1933,
1313,
16,
938,
4457,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
20377,
333,
804,
23764,
17,
29111,
28345,
2492,
733,
1368,
326,
938,
1807,
8901,
710,
5947,
97,
733,
18,
203,
377,
380,
203,
377,
380,
632,
15069,
2141,
9738,
309,
1915,
4591,
1281,
501,
6237,
26889,
316,
326,
28345,
2492,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
a9c0ffe943a4294d2a1b75f3196164c0c2d88060 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/ISegment.java | [
"Apache-2.0"
] | Java | fromString | Type | public static Type fromString(String type, Type defaultValue)
{
if ( type == null ) {
return defaultValue;
}
type = type.toLowerCase();
if ( "simple".equals(type) ) {
return Type.SIMPLE;
} else if ( "complex".equals(type) ) {
return Type.COMPLEX;
} else if ( "detect".equals(type) ) {
return Type.DETECT;
} else if ( "most".equals(type) ) {
return Type.MOST;
} else if ( "nlp".equals(type) ) {
return Type.NLP;
} else if ( "delimiter".equals(type) ) {
return Type.DELIMITER;
} else if ( "ngram".equals(type) ) {
return Type.NGRAM;
}
return defaultValue;
} | /**
* get the Type with the specified string name
*
* @param type (All lowercase string)
* @return Type
*/ | get the Type with the specified string name
@param type (All lowercase string)
@return Type | [
"get",
"the",
"Type",
"with",
"the",
"specified",
"string",
"name",
"@param",
"type",
"(",
"All",
"lowercase",
"string",
")",
"@return",
"Type"
] | public static Type fromString(String type, Type defaultValue)
{
if ( type == null ) {
return defaultValue;
}
type = type.toLowerCase();
if ( "simple".equals(type) ) {
return Type.SIMPLE;
} else if ( "complex".equals(type) ) {
return Type.COMPLEX;
} else if ( "detect".equals(type) ) {
return Type.DETECT;
} else if ( "most".equals(type) ) {
return Type.MOST;
} else if ( "nlp".equals(type) ) {
return Type.NLP;
} else if ( "delimiter".equals(type) ) {
return Type.DELIMITER;
} else if ( "ngram".equals(type) ) {
return Type.NGRAM;
}
return defaultValue;
} | [
"public",
"static",
"Type",
"fromString",
"(",
"String",
"type",
",",
"Type",
"defaultValue",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"type",
"=",
"type",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"\"simple\"",
".",
"equals",
"(",
"type",
")",
")",
"{",
"return",
"Type",
".",
"SIMPLE",
";",
"}",
"else",
"if",
"(",
"\"complex\"",
".",
"equals",
"(",
"type",
")",
")",
"{",
"return",
"Type",
".",
"COMPLEX",
";",
"}",
"else",
"if",
"(",
"\"detect\"",
".",
"equals",
"(",
"type",
")",
")",
"{",
"return",
"Type",
".",
"DETECT",
";",
"}",
"else",
"if",
"(",
"\"most\"",
".",
"equals",
"(",
"type",
")",
")",
"{",
"return",
"Type",
".",
"MOST",
";",
"}",
"else",
"if",
"(",
"\"nlp\"",
".",
"equals",
"(",
"type",
")",
")",
"{",
"return",
"Type",
".",
"NLP",
";",
"}",
"else",
"if",
"(",
"\"delimiter\"",
".",
"equals",
"(",
"type",
")",
")",
"{",
"return",
"Type",
".",
"DELIMITER",
";",
"}",
"else",
"if",
"(",
"\"ngram\"",
".",
"equals",
"(",
"type",
")",
")",
"{",
"return",
"Type",
".",
"NGRAM",
";",
"}",
"return",
"defaultValue",
";",
"}"
] | get the Type with the specified string name | [
"get",
"the",
"Type",
"with",
"the",
"specified",
"string",
"name"
] | [] | [
{
"param": "type",
"type": "String"
},
{
"param": "defaultValue",
"type": "Type"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "defaultValue",
"type": "Type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1412,
14855,
12,
780,
618,
16,
1412,
4593,
13,
203,
3639,
288,
203,
540,
202,
430,
261,
618,
422,
446,
262,
288,
203,
540,
202,
202,
2463,
4593,
31,
203,
540,
202,
97,
203,
540,
202,
203,
5411,
618,
273,
618,
18,
869,
5630,
5621,
203,
5411,
309,
261,
315,
9647,
9654,
14963,
12,
723,
13,
262,
288,
203,
7734,
327,
1412,
18,
31669,
900,
31,
203,
5411,
289,
469,
309,
261,
315,
14259,
9654,
14963,
12,
723,
13,
262,
288,
203,
7734,
327,
1412,
18,
10057,
21130,
31,
203,
5411,
289,
469,
309,
261,
315,
16518,
9654,
14963,
12,
723,
13,
262,
288,
203,
7734,
327,
1412,
18,
1639,
1448,
1268,
31,
203,
5411,
289,
469,
309,
261,
315,
10329,
9654,
14963,
12,
723,
13,
262,
288,
203,
7734,
327,
1412,
18,
49,
4005,
31,
203,
5411,
289,
469,
309,
261,
315,
24853,
9654,
14963,
12,
723,
13,
262,
288,
203,
7734,
327,
1412,
18,
50,
14461,
31,
203,
5411,
289,
469,
309,
261,
315,
15751,
9654,
14963,
12,
723,
13,
262,
288,
203,
7734,
327,
1412,
18,
19722,
31,
203,
5411,
289,
469,
309,
261,
315,
82,
3295,
9654,
14963,
12,
723,
13,
262,
288,
203,
7734,
327,
1412,
18,
4960,
54,
2192,
31,
203,
5411,
289,
203,
2398,
203,
5411,
327,
4593,
31,
203,
3639,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
540,
380,
336,
326,
1412,
598,
326,
1269,
533,
508,
203,
540,
380,
7010,
540,
380,
632,
891,
282,
618,
261,
1595,
12400,
533,
13,
203,
540,
380,
632,
2463,
225,
1412,
203,
3639,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
cc9a7c89f2226e51cc1c8afb417551cf76f80ed2 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/extractor/impl/TextRankSummaryExtractor.java | [
"Apache-2.0"
] | Java | sum | null | static double sum(double[] score)
{
double r = 0D;
for ( double d : score ) r += d;
return r;
} | /**
* sum the specified double array
*
* @param score
* @return double
*/ | sum the specified double array
@param score
@return double | [
"sum",
"the",
"specified",
"double",
"array",
"@param",
"score",
"@return",
"double"
] | static double sum(double[] score)
{
double r = 0D;
for ( double d : score ) r += d;
return r;
} | [
"static",
"double",
"sum",
"(",
"double",
"[",
"]",
"score",
")",
"{",
"double",
"r",
"=",
"0D",
";",
"for",
"(",
"double",
"d",
":",
"score",
")",
"r",
"+=",
"d",
";",
"return",
"r",
";",
"}"
] | sum the specified double array | [
"sum",
"the",
"specified",
"double",
"array"
] | [] | [
{
"param": "score",
"type": "double[]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "score",
"type": "double[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
760,
1645,
2142,
12,
9056,
8526,
4462,
13,
203,
565,
288,
203,
3639,
1645,
436,
273,
374,
40,
31,
203,
3639,
364,
261,
1645,
302,
294,
4462,
262,
436,
1011,
302,
31,
203,
3639,
327,
436,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2142,
326,
1269,
1645,
526,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
4462,
203,
377,
380,
632,
2463,
225,
1645,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
cc9a7c89f2226e51cc1c8afb417551cf76f80ed2 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/extractor/impl/TextRankSummaryExtractor.java | [
"Apache-2.0"
] | Java | textRankSortedDocuments | null | protected Document[] textRankSortedDocuments(
List<Sentence> sentence, List<List<IWord>> senWords) throws IOException
{
int docNum = sentence.size();
//documents relevance matrix build
double[][] relevance = BM25RelevanceMatixBuild(sentence, senWords);
//org.lionsoul.jcseg.util.Util.printMatrix(relevance);
double[] score = new double[docNum];
double[] weight_sum = new double[docNum];
for ( int i = 0; i < docNum; i++ ) {
weight_sum[i] = sum(relevance[i]) - relevance[i][i];
score[i] = 0;
}
//do the textrank score iteration
for ( int c = 0; c < maxIterateNum; c++ ) {
for ( int i = 0; i < docNum; i++ ) {
double sigema = 0D;
for ( int j = 0; j < docNum; j++ ) {
if ( i == j || weight_sum[j] == 0 ) continue;
/*
* ws(vj) * wji / sigma(wjk) with k in Out(Vj)
* ws(vj): score[j] the score of document[j]
* wji: relevance score bettween document[j] and document[i]
* sigema(wjk): weight sum for document[j]
*/
sigema += relevance[j][i] / weight_sum[j] * score[j];
}
score[i] = 1 - D + D * sigema;
}
}
//build the document set
//and sort the documents by scores
Document[] docs = new Document[docNum];
for ( int i = 0; i < docNum; i++ ) {
docs[i] = new Document(i, sentence.get(i), senWords.get(i), score[i]);
}
Sort.shellSort(docs);
//let gc do its works
relevance = null;
score = null;
weight_sum = null;
return docs;
} | /**
* get the documents order by relevance score.
*
* @param sentence
* @param senWords
* @throws IOException
*/ | get the documents order by relevance score.
@param sentence
@param senWords
@throws IOException | [
"get",
"the",
"documents",
"order",
"by",
"relevance",
"score",
".",
"@param",
"sentence",
"@param",
"senWords",
"@throws",
"IOException"
] | protected Document[] textRankSortedDocuments(
List<Sentence> sentence, List<List<IWord>> senWords) throws IOException
{
int docNum = sentence.size();
double[][] relevance = BM25RelevanceMatixBuild(sentence, senWords);
double[] score = new double[docNum];
double[] weight_sum = new double[docNum];
for ( int i = 0; i < docNum; i++ ) {
weight_sum[i] = sum(relevance[i]) - relevance[i][i];
score[i] = 0;
}
for ( int c = 0; c < maxIterateNum; c++ ) {
for ( int i = 0; i < docNum; i++ ) {
double sigema = 0D;
for ( int j = 0; j < docNum; j++ ) {
if ( i == j || weight_sum[j] == 0 ) continue;
/*
* ws(vj) * wji / sigma(wjk) with k in Out(Vj)
* ws(vj): score[j] the score of document[j]
* wji: relevance score bettween document[j] and document[i]
* sigema(wjk): weight sum for document[j]
*/
sigema += relevance[j][i] / weight_sum[j] * score[j];
}
score[i] = 1 - D + D * sigema;
}
}
Document[] docs = new Document[docNum];
for ( int i = 0; i < docNum; i++ ) {
docs[i] = new Document(i, sentence.get(i), senWords.get(i), score[i]);
}
Sort.shellSort(docs);
relevance = null;
score = null;
weight_sum = null;
return docs;
} | [
"protected",
"Document",
"[",
"]",
"textRankSortedDocuments",
"(",
"List",
"<",
"Sentence",
">",
"sentence",
",",
"List",
"<",
"List",
"<",
"IWord",
">",
">",
"senWords",
")",
"throws",
"IOException",
"{",
"int",
"docNum",
"=",
"sentence",
".",
"size",
"(",
")",
";",
"double",
"[",
"]",
"[",
"]",
"relevance",
"=",
"BM25RelevanceMatixBuild",
"(",
"sentence",
",",
"senWords",
")",
";",
"double",
"[",
"]",
"score",
"=",
"new",
"double",
"[",
"docNum",
"]",
";",
"double",
"[",
"]",
"weight_sum",
"=",
"new",
"double",
"[",
"docNum",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"docNum",
";",
"i",
"++",
")",
"{",
"weight_sum",
"[",
"i",
"]",
"=",
"sum",
"(",
"relevance",
"[",
"i",
"]",
")",
"-",
"relevance",
"[",
"i",
"]",
"[",
"i",
"]",
";",
"score",
"[",
"i",
"]",
"=",
"0",
";",
"}",
"for",
"(",
"int",
"c",
"=",
"0",
";",
"c",
"<",
"maxIterateNum",
";",
"c",
"++",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"docNum",
";",
"i",
"++",
")",
"{",
"double",
"sigema",
"=",
"0D",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"docNum",
";",
"j",
"++",
")",
"{",
"if",
"(",
"i",
"==",
"j",
"||",
"weight_sum",
"[",
"j",
"]",
"==",
"0",
")",
"continue",
";",
"/*\n * ws(vj) * wji / sigma(wjk) with k in Out(Vj) \n * ws(vj): score[j] the score of document[j]\n * wji: relevance score bettween document[j] and document[i]\n * sigema(wjk): weight sum for document[j]\n */",
"sigema",
"+=",
"relevance",
"[",
"j",
"]",
"[",
"i",
"]",
"/",
"weight_sum",
"[",
"j",
"]",
"*",
"score",
"[",
"j",
"]",
";",
"}",
"score",
"[",
"i",
"]",
"=",
"1",
"-",
"D",
"+",
"D",
"*",
"sigema",
";",
"}",
"}",
"Document",
"[",
"]",
"docs",
"=",
"new",
"Document",
"[",
"docNum",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"docNum",
";",
"i",
"++",
")",
"{",
"docs",
"[",
"i",
"]",
"=",
"new",
"Document",
"(",
"i",
",",
"sentence",
".",
"get",
"(",
"i",
")",
",",
"senWords",
".",
"get",
"(",
"i",
")",
",",
"score",
"[",
"i",
"]",
")",
";",
"}",
"Sort",
".",
"shellSort",
"(",
"docs",
")",
";",
"relevance",
"=",
"null",
";",
"score",
"=",
"null",
";",
"weight_sum",
"=",
"null",
";",
"return",
"docs",
";",
"}"
] | get the documents order by relevance score. | [
"get",
"the",
"documents",
"order",
"by",
"relevance",
"score",
"."
] | [
"//documents relevance matrix build",
"//org.lionsoul.jcseg.util.Util.printMatrix(relevance);",
"//do the textrank score iteration",
"//build the document set",
"//and sort the documents by scores",
"//let gc do its works"
] | [
{
"param": "sentence",
"type": "List<Sentence>"
},
{
"param": "senWords",
"type": "List<List<IWord>>"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sentence",
"type": "List<Sentence>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "senWords",
"type": "List<List<IWord>>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
4319,
8526,
977,
12925,
11739,
12922,
12,
203,
5411,
987,
32,
17923,
34,
7515,
16,
987,
32,
682,
32,
45,
3944,
9778,
28901,
7363,
13,
1216,
1860,
203,
565,
288,
203,
3639,
509,
997,
2578,
273,
7515,
18,
1467,
5621,
203,
377,
203,
3639,
368,
24795,
6707,
5882,
3148,
1361,
203,
3639,
1645,
63,
6362,
65,
6707,
5882,
273,
605,
49,
2947,
17018,
5882,
15947,
697,
3116,
12,
19335,
16,
28901,
7363,
1769,
203,
3639,
368,
3341,
18,
80,
1115,
1003,
18,
78,
71,
5680,
18,
1367,
18,
1304,
18,
1188,
4635,
12,
16599,
5882,
1769,
203,
540,
203,
3639,
1645,
8526,
4462,
273,
394,
1645,
63,
2434,
2578,
15533,
203,
3639,
1645,
8526,
3119,
67,
1364,
273,
394,
1645,
63,
2434,
2578,
15533,
203,
3639,
364,
261,
509,
277,
273,
374,
31,
277,
411,
997,
2578,
31,
277,
9904,
262,
288,
203,
5411,
3119,
67,
1364,
63,
77,
65,
273,
2142,
12,
16599,
5882,
63,
77,
5717,
300,
6707,
5882,
63,
77,
6362,
77,
15533,
203,
5411,
4462,
63,
77,
65,
273,
374,
31,
203,
3639,
289,
203,
540,
203,
3639,
368,
2896,
326,
268,
14523,
2304,
4462,
6532,
203,
3639,
364,
261,
509,
276,
273,
374,
31,
276,
411,
943,
14916,
2578,
31,
276,
9904,
262,
288,
203,
5411,
364,
261,
509,
277,
273,
374,
31,
277,
411,
997,
2578,
31,
277,
9904,
262,
288,
203,
7734,
1645,
3553,
351,
69,
273,
374,
40,
31,
203,
7734,
364,
261,
509,
525,
273,
374,
31,
525,
411,
997,
2578,
31,
525,
9904,
262,
288,
203,
10792,
309,
261,
277,
422,
525,
747,
3119,
67,
1364,
63,
78,
65,
422,
374,
262,
1324,
31,
203,
10792,
1748,
203,
5397,
380,
4945,
12,
90,
78,
13,
380,
341,
21102,
342,
7299,
12,
91,
26921,
13,
598,
417,
316,
2976,
12,
58,
78,
13,
7010,
5397,
380,
4945,
12,
90,
78,
4672,
4462,
63,
78,
65,
326,
4462,
434,
1668,
63,
78,
65,
203,
5397,
380,
341,
21102,
30,
6707,
5882,
4462,
2701,
88,
2717,
1668,
63,
78,
65,
471,
1668,
63,
77,
65,
203,
5397,
380,
3553,
351,
69,
12,
91,
26921,
4672,
3119,
2142,
364,
1668,
63,
78,
65,
203,
10792,
1195,
203,
10792,
3553,
351,
69,
1011,
6707,
5882,
63,
78,
6362,
77,
65,
342,
3119,
67,
1364,
63,
78,
65,
380,
4462,
63,
78,
15533,
203,
7734,
289,
203,
1171,
203,
7734,
4462,
63,
77,
65,
273,
404,
300,
463,
397,
463,
380,
3553,
351,
69,
31,
203,
5411,
289,
203,
3639,
289,
203,
540,
203,
3639,
368,
3510,
326,
1668,
444,
203,
3639,
368,
464,
1524,
326,
7429,
635,
8474,
203,
3639,
4319,
8526,
3270,
273,
394,
4319,
63,
2434,
2578,
15533,
203,
3639,
364,
261,
509,
277,
273,
374,
31,
277,
411,
997,
2578,
31,
277,
9904,
262,
288,
203,
5411,
3270,
63,
77,
65,
273,
394,
4319,
12,
77,
16,
7515,
18,
588,
12,
77,
3631,
28901,
7363,
18,
588,
12,
77,
3631,
4462,
63,
77,
19226,
203,
3639,
289,
203,
540,
203,
3639,
5928,
18,
10304,
4416,
12,
8532,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
336,
326,
7429,
1353,
635,
6707,
5882,
4462,
18,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
7515,
203,
377,
380,
632,
891,
282,
28901,
7363,
203,
377,
380,
632,
15069,
225,
1860,
7010,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
cc9a7c89f2226e51cc1c8afb417551cf76f80ed2 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/extractor/impl/TextRankSummaryExtractor.java | [
"Apache-2.0"
] | Java | compareTo | null | @Override
public int compareTo(Document o)
{
double v = o.getScore() - score;
if ( v > 0 ) return 1;
if ( v < 0 ) return -1;
return 0;
} | /**
* override the compareTo method
* compare document with its relevance score
*
* @param o
*/ | override the compareTo method
compare document with its relevance score
@param o | [
"override",
"the",
"compareTo",
"method",
"compare",
"document",
"with",
"its",
"relevance",
"score",
"@param",
"o"
] | @Override
public int compareTo(Document o)
{
double v = o.getScore() - score;
if ( v > 0 ) return 1;
if ( v < 0 ) return -1;
return 0;
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"Document",
"o",
")",
"{",
"double",
"v",
"=",
"o",
".",
"getScore",
"(",
")",
"-",
"score",
";",
"if",
"(",
"v",
">",
"0",
")",
"return",
"1",
";",
"if",
"(",
"v",
"<",
"0",
")",
"return",
"-",
"1",
";",
"return",
"0",
";",
"}"
] | override the compareTo method
compare document with its relevance score | [
"override",
"the",
"compareTo",
"method",
"compare",
"document",
"with",
"its",
"relevance",
"score"
] | [] | [
{
"param": "o",
"type": "Document"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "o",
"type": "Document",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
3639,
1071,
509,
9292,
12,
2519,
320,
13,
7010,
3639,
288,
203,
5411,
1645,
331,
273,
320,
18,
588,
7295,
1435,
300,
4462,
31,
203,
5411,
309,
261,
331,
405,
374,
262,
327,
404,
31,
203,
5411,
309,
261,
331,
411,
374,
262,
327,
300,
21,
31,
203,
5411,
327,
374,
31,
203,
3639,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
540,
380,
3849,
326,
9292,
707,
203,
540,
380,
3400,
1668,
598,
2097,
6707,
5882,
4462,
203,
540,
380,
7010,
540,
380,
632,
891,
282,
320,
203,
3639,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
b90ed7854a67b1dac0a7b353e226b3c3b3fc586d | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/segmenter/DetectSeg.java | [
"Apache-2.0"
] | Java | readNext | null | protected int readNext() throws IOException
{
int c = reader.read();
if ( c != -1 ) idx++;
return c;
} | /**
* read the next char from the current position
*
* @return int
* @throws IOException
*/ | read the next char from the current position
@return int
@throws IOException | [
"read",
"the",
"next",
"char",
"from",
"the",
"current",
"position",
"@return",
"int",
"@throws",
"IOException"
] | protected int readNext() throws IOException
{
int c = reader.read();
if ( c != -1 ) idx++;
return c;
} | [
"protected",
"int",
"readNext",
"(",
")",
"throws",
"IOException",
"{",
"int",
"c",
"=",
"reader",
".",
"read",
"(",
")",
";",
"if",
"(",
"c",
"!=",
"-",
"1",
")",
"idx",
"++",
";",
"return",
"c",
";",
"}"
] | read the next char from the current position | [
"read",
"the",
"next",
"char",
"from",
"the",
"current",
"position"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
509,
855,
2134,
1435,
1216,
1860,
7010,
565,
288,
377,
203,
3639,
509,
276,
273,
2949,
18,
896,
5621,
203,
3639,
309,
261,
276,
480,
300,
21,
262,
2067,
9904,
31,
203,
3639,
327,
276,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
855,
326,
1024,
1149,
628,
326,
783,
1754,
203,
377,
380,
7010,
377,
380,
632,
2463,
225,
509,
203,
377,
380,
632,
15069,
225,
1860,
7010,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
b90ed7854a67b1dac0a7b353e226b3c3b3fc586d | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/segmenter/DetectSeg.java | [
"Apache-2.0"
] | Java | pushBack | null | protected void pushBack( int data ) throws IOException
{
reader.unread(data);
idx--;
} | /**
* push back the data to the stream
*
* @param data
* @throws IOException
*/ | push back the data to the stream
@param data
@throws IOException | [
"push",
"back",
"the",
"data",
"to",
"the",
"stream",
"@param",
"data",
"@throws",
"IOException"
] | protected void pushBack( int data ) throws IOException
{
reader.unread(data);
idx--;
} | [
"protected",
"void",
"pushBack",
"(",
"int",
"data",
")",
"throws",
"IOException",
"{",
"reader",
".",
"unread",
"(",
"data",
")",
";",
"idx",
"--",
";",
"}"
] | push back the data to the stream | [
"push",
"back",
"the",
"data",
"to",
"the",
"stream"
] | [] | [
{
"param": "data",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
1817,
2711,
12,
509,
501,
262,
1216,
1860,
7010,
565,
288,
203,
3639,
2949,
18,
318,
896,
12,
892,
1769,
203,
3639,
2067,
413,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1817,
1473,
326,
501,
358,
326,
1407,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
501,
203,
377,
380,
632,
15069,
225,
1860,
7010,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
666ca002e01eaab2cbcc18015a583d2c4bed37fc | passerbya/jcseg | jcseg-server/src/main/java/org/lionsoul/jcseg/server/JcsegServer.java | [
"Apache-2.0"
] | Java | init | null | private void init()
{
//setup thread pool
QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.setMaxThreads(config.getMaxThreadPoolSize());
threadPool.setIdleTimeout(config.getThreadIdleTimeout());
server = new Server(threadPool);
//setup the http configuration
HttpConfiguration http_config = new HttpConfiguration();
http_config.setOutputBufferSize(config.getOutputBufferSize());
http_config.setRequestHeaderSize(config.getRequestHeaderSize());
http_config.setResponseHeaderSize(config.getResponseHeaderSize());
http_config.setSendServerVersion(false);
http_config.setSendDateHeader(false);
//setup the connector
ServerConnector connector = new ServerConnector(
server,
new HttpConnectionFactory(http_config)
);
connector.setPort(config.getPort());
connector.setHost(config.getHost());
connector.setIdleTimeout(config.getHttpIdleTimeout());
server.addConnector(connector);
} | /**
* initialize the server and register the basic context handler
*/ | initialize the server and register the basic context handler | [
"initialize",
"the",
"server",
"and",
"register",
"the",
"basic",
"context",
"handler"
] | private void init()
{
QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.setMaxThreads(config.getMaxThreadPoolSize());
threadPool.setIdleTimeout(config.getThreadIdleTimeout());
server = new Server(threadPool);
HttpConfiguration http_config = new HttpConfiguration();
http_config.setOutputBufferSize(config.getOutputBufferSize());
http_config.setRequestHeaderSize(config.getRequestHeaderSize());
http_config.setResponseHeaderSize(config.getResponseHeaderSize());
http_config.setSendServerVersion(false);
http_config.setSendDateHeader(false);
ServerConnector connector = new ServerConnector(
server,
new HttpConnectionFactory(http_config)
);
connector.setPort(config.getPort());
connector.setHost(config.getHost());
connector.setIdleTimeout(config.getHttpIdleTimeout());
server.addConnector(connector);
} | [
"private",
"void",
"init",
"(",
")",
"{",
"QueuedThreadPool",
"threadPool",
"=",
"new",
"QueuedThreadPool",
"(",
")",
";",
"threadPool",
".",
"setMaxThreads",
"(",
"config",
".",
"getMaxThreadPoolSize",
"(",
")",
")",
";",
"threadPool",
".",
"setIdleTimeout",
"(",
"config",
".",
"getThreadIdleTimeout",
"(",
")",
")",
";",
"server",
"=",
"new",
"Server",
"(",
"threadPool",
")",
";",
"HttpConfiguration",
"http_config",
"=",
"new",
"HttpConfiguration",
"(",
")",
";",
"http_config",
".",
"setOutputBufferSize",
"(",
"config",
".",
"getOutputBufferSize",
"(",
")",
")",
";",
"http_config",
".",
"setRequestHeaderSize",
"(",
"config",
".",
"getRequestHeaderSize",
"(",
")",
")",
";",
"http_config",
".",
"setResponseHeaderSize",
"(",
"config",
".",
"getResponseHeaderSize",
"(",
")",
")",
";",
"http_config",
".",
"setSendServerVersion",
"(",
"false",
")",
";",
"http_config",
".",
"setSendDateHeader",
"(",
"false",
")",
";",
"ServerConnector",
"connector",
"=",
"new",
"ServerConnector",
"(",
"server",
",",
"new",
"HttpConnectionFactory",
"(",
"http_config",
")",
")",
";",
"connector",
".",
"setPort",
"(",
"config",
".",
"getPort",
"(",
")",
")",
";",
"connector",
".",
"setHost",
"(",
"config",
".",
"getHost",
"(",
")",
")",
";",
"connector",
".",
"setIdleTimeout",
"(",
"config",
".",
"getHttpIdleTimeout",
"(",
")",
")",
";",
"server",
".",
"addConnector",
"(",
"connector",
")",
";",
"}"
] | initialize the server and register the basic context handler | [
"initialize",
"the",
"server",
"and",
"register",
"the",
"basic",
"context",
"handler"
] | [
"//setup thread pool",
"//setup the http configuration",
"//setup the connector"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
918,
1208,
1435,
203,
565,
288,
203,
3639,
368,
8401,
2650,
2845,
203,
3639,
27949,
5957,
20621,
2650,
2864,
273,
394,
27949,
5957,
20621,
5621,
203,
3639,
2650,
2864,
18,
542,
2747,
13233,
12,
1425,
18,
588,
2747,
3830,
18834,
10663,
203,
3639,
2650,
2864,
18,
542,
13834,
2694,
12,
1425,
18,
588,
3830,
13834,
2694,
10663,
203,
540,
203,
3639,
1438,
273,
394,
3224,
12,
5930,
2864,
1769,
203,
540,
203,
3639,
368,
8401,
326,
1062,
1664,
203,
3639,
2541,
1750,
1062,
67,
1425,
273,
394,
2541,
1750,
5621,
203,
3639,
1062,
67,
1425,
18,
542,
1447,
15384,
12,
1425,
18,
588,
1447,
15384,
10663,
203,
3639,
1062,
67,
1425,
18,
542,
691,
1864,
1225,
12,
1425,
18,
588,
691,
1864,
1225,
10663,
203,
3639,
1062,
67,
1425,
18,
542,
1064,
1864,
1225,
12,
1425,
18,
588,
1064,
1864,
1225,
10663,
203,
3639,
1062,
67,
1425,
18,
542,
3826,
2081,
1444,
12,
5743,
1769,
203,
3639,
1062,
67,
1425,
18,
542,
3826,
1626,
1864,
12,
5743,
1769,
203,
540,
203,
3639,
368,
8401,
326,
8703,
203,
3639,
3224,
7487,
8703,
273,
394,
3224,
7487,
12,
203,
5411,
1438,
16,
7010,
5411,
394,
2541,
18749,
12,
2505,
67,
1425,
13,
203,
3639,
11272,
203,
3639,
8703,
18,
542,
2617,
12,
1425,
18,
588,
2617,
10663,
203,
3639,
8703,
18,
542,
2594,
12,
1425,
18,
588,
2594,
10663,
203,
3639,
8703,
18,
542,
13834,
2694,
12,
1425,
18,
588,
2940,
13834,
2694,
10663,
203,
3639,
1438,
18,
1289,
7487,
12,
23159,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
4046,
326,
1438,
471,
1744,
326,
5337,
819,
1838,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
666ca002e01eaab2cbcc18015a583d2c4bed37fc | passerbya/jcseg | jcseg-server/src/main/java/org/lionsoul/jcseg/server/JcsegServer.java | [
"Apache-2.0"
] | Java | initFromGlobalConfig | JcsegServer | public JcsegServer initFromGlobalConfig(JSONObject globalConfig) throws CloneNotSupportedException
{
/*
* parse and initialize the server according to the global config
*/
if ( globalConfig.has("server_config") ) {
JSONObject serverSetting = globalConfig.getJSONObject("server_config");
if ( serverSetting.has("host") ) {
config.setHost(serverSetting.getString("host"));
}
if ( serverSetting.has("port") ) {
config.setPort(serverSetting.getInt("port"));
}
if ( serverSetting.has("charset") ) {
config.setCharset(serverSetting.getString("charset"));
}
if ( serverSetting.has("max_thread_pool_size") ) {
config.setMaxThreadPoolSize(serverSetting.getInt("max_thread_pool_size"));
}
if ( serverSetting.has("thread_idle_timeout") ) {
config.setThreadIdleTimeout(serverSetting.getInt("thread_idle_timeout"));
}
if ( serverSetting.has("http_output_buffer_size") ) {
config.setOutputBufferSize(serverSetting.getInt("http_output_buffer_size"));
}
if ( serverSetting.has("http_request_header_size") ) {
config.setRequestHeaderSize(serverSetting.getInt("http_request_header_size"));
}
if ( serverSetting.has("http_response_header_size") ) {
config.setResponseHeaderSize(serverSetting.getInt("http_connection_idle_timeout"));
}
}
//create a global JcsegTaskConfig and initialize from the global_setting
SegmenterConfig globalJcsegTaskConfig = new SegmenterConfig(false);
if ( globalConfig.has("jcseg_global_config") ) {
JSONObject globalSetting = globalConfig.getJSONObject("jcseg_global_config");
resetJcsegTaskConfig(globalJcsegTaskConfig, globalSetting);
}
/*
* create the dictionaries according to the definition of dict
* and we will make a copy of the globalSetting for dictionary load
*
* reset the max length to pass the dictionary words length limitation
*/
SegmenterConfig dictLoadConfig = globalJcsegTaskConfig.clone();
dictLoadConfig.setMaxLength(100);
if ( globalConfig.has("jcseg_dict") ) {
JSONObject dictSetting = globalConfig.getJSONObject("jcseg_dict");
String[] dictNames = JSONObject.getNames(dictSetting);
for ( String name : dictNames ) {
JSONObject dicJson = dictSetting.getJSONObject(name);
if ( ! dicJson.has("path") ) {
throw new IllegalArgumentException("Missing path for dict instance " + name);
}
String[] lexPath = null;
if ( ! dicJson.isNull("path") ) {
//process the lexPath
JSONArray path = dicJson.getJSONArray("path");
List<String> dicPath = new ArrayList<String>();
for ( int i = 0; i < path.length(); i++ ) {
String filePath = path.get(i).toString();
if ( filePath.indexOf("{jar.dir}") > -1 ) {
filePath = filePath.replace("{jar.dir}", Util.getJarHome(this));
}
dicPath.add(filePath);
}
lexPath = new String[dicPath.size()];
dicPath.toArray(lexPath);
dicPath.clear(); dicPath = null;
}
boolean loadpos = dicJson.has("loadpos")
? dicJson.getBoolean("loadpos") : true;
boolean loadpinyin = dicJson.has("loadpinyin")
? dicJson.getBoolean("loadpinyin") : true;
boolean loadsyn = dicJson.has("loadsyn")
? dicJson.getBoolean("loadsyn") : true;
boolean loadentity = dicJson.has("loadentity")
? dicJson.getBoolean("loadentity") : true;
boolean autoload = dicJson.has("autoload")
? dicJson.getBoolean("autoload") : false;
int polltime = dicJson.has("polltime")
? dicJson.getInt("polltime") : 300;
dictLoadConfig.setLoadCJKPinyin(loadpinyin);
dictLoadConfig.setLoadCJKPos(loadpos);
dictLoadConfig.setLoadCJKSyn(loadsyn);
dictLoadConfig.setLoadEntity(loadentity);
dictLoadConfig.setAutoload(autoload);
dictLoadConfig.setPollTime(polltime);
dictLoadConfig.setLexiconPath(lexPath);
//create and register the global dictionary resource
ADictionary dic = DictionaryFactory.createDefaultDictionary(dictLoadConfig);
resourcePool.addDict(name, dic);
}
}
dictLoadConfig = null;
/*
* create the JcsegTaskConfig instance according to the definition config
*/
if ( globalConfig.has("jcseg_config") ) {
JSONObject configSetting = globalConfig.getJSONObject("jcseg_config");
String[] configNames = JSONObject.getNames(configSetting);
for ( String name : configNames ) {
JSONObject configJson = configSetting.getJSONObject(name);
//clone the globalJcsegTaskConfig
//and do the override working by local defination
SegmenterConfig config = globalJcsegTaskConfig.clone();
if ( configJson.length() > 0 ) {
resetJcsegTaskConfig(config, configJson);
}
//register the global resource
resourcePool.addConfig(name, config);
}
}
/*
* create the tokenizer instance according the definition of tokenizer
*/
if ( globalConfig.has("jcseg_tokenizer") ) {
JSONObject tokenizerSetting = globalConfig.getJSONObject("jcseg_tokenizer");
String[] tokenizerNames = JSONObject.getNames(tokenizerSetting);
for ( String name : tokenizerNames ) {
JSONObject tokenizerJson = tokenizerSetting.getJSONObject(name);
int algorithm = tokenizerJson.has("algorithm")
? tokenizerJson.getInt("algorithm") : ISegment.COMPLEX_MODE;
if ( ! tokenizerJson.has("dict") ) {
throw new IllegalArgumentException("Missing dict setting for tokenizer " + name);
}
if ( ! tokenizerJson.has("config") ) {
throw new IllegalArgumentException("Missing config setting for tokenizer " + name);
}
ADictionary dic = resourcePool.getDict(tokenizerJson.getString("dict"));
SegmenterConfig config = resourcePool.getConfig(tokenizerJson.getString("config"));
if ( dic == null ) {
throw new IllegalArgumentException("Unknow dict instance "
+ tokenizerJson.getString("dict") + " for tokenizer " + name);
}
if ( config == null ) {
throw new IllegalArgumentException("Unknow config instance "
+ tokenizerJson.getString("config") + " for tokenizer " + name);
}
resourcePool.addTokenizerEntry(name, new JcsegTokenizerEntry(algorithm, config, dic));
}
}
//now, initialize the server
init();
return this;
} | /**
* load configuration.
* 1. initialize the server config
* 2. register global resource (global resource initialize)
*
* @param globalConfig
* @return JcsegServer
* @throws CloneNotSupportedException
* @throws JcsegException
*/ | load configuration.
1. initialize the server config
2. register global resource (global resource initialize)
| [
"load",
"configuration",
".",
"1",
".",
"initialize",
"the",
"server",
"config",
"2",
".",
"register",
"global",
"resource",
"(",
"global",
"resource",
"initialize",
")"
] | public JcsegServer initFromGlobalConfig(JSONObject globalConfig) throws CloneNotSupportedException
{
/*
* parse and initialize the server according to the global config
*/
if ( globalConfig.has("server_config") ) {
JSONObject serverSetting = globalConfig.getJSONObject("server_config");
if ( serverSetting.has("host") ) {
config.setHost(serverSetting.getString("host"));
}
if ( serverSetting.has("port") ) {
config.setPort(serverSetting.getInt("port"));
}
if ( serverSetting.has("charset") ) {
config.setCharset(serverSetting.getString("charset"));
}
if ( serverSetting.has("max_thread_pool_size") ) {
config.setMaxThreadPoolSize(serverSetting.getInt("max_thread_pool_size"));
}
if ( serverSetting.has("thread_idle_timeout") ) {
config.setThreadIdleTimeout(serverSetting.getInt("thread_idle_timeout"));
}
if ( serverSetting.has("http_output_buffer_size") ) {
config.setOutputBufferSize(serverSetting.getInt("http_output_buffer_size"));
}
if ( serverSetting.has("http_request_header_size") ) {
config.setRequestHeaderSize(serverSetting.getInt("http_request_header_size"));
}
if ( serverSetting.has("http_response_header_size") ) {
config.setResponseHeaderSize(serverSetting.getInt("http_connection_idle_timeout"));
}
}
SegmenterConfig globalJcsegTaskConfig = new SegmenterConfig(false);
if ( globalConfig.has("jcseg_global_config") ) {
JSONObject globalSetting = globalConfig.getJSONObject("jcseg_global_config");
resetJcsegTaskConfig(globalJcsegTaskConfig, globalSetting);
}
/*
* create the dictionaries according to the definition of dict
* and we will make a copy of the globalSetting for dictionary load
*
* reset the max length to pass the dictionary words length limitation
*/
SegmenterConfig dictLoadConfig = globalJcsegTaskConfig.clone();
dictLoadConfig.setMaxLength(100);
if ( globalConfig.has("jcseg_dict") ) {
JSONObject dictSetting = globalConfig.getJSONObject("jcseg_dict");
String[] dictNames = JSONObject.getNames(dictSetting);
for ( String name : dictNames ) {
JSONObject dicJson = dictSetting.getJSONObject(name);
if ( ! dicJson.has("path") ) {
throw new IllegalArgumentException("Missing path for dict instance " + name);
}
String[] lexPath = null;
if ( ! dicJson.isNull("path") ) {
JSONArray path = dicJson.getJSONArray("path");
List<String> dicPath = new ArrayList<String>();
for ( int i = 0; i < path.length(); i++ ) {
String filePath = path.get(i).toString();
if ( filePath.indexOf("{jar.dir}") > -1 ) {
filePath = filePath.replace("{jar.dir}", Util.getJarHome(this));
}
dicPath.add(filePath);
}
lexPath = new String[dicPath.size()];
dicPath.toArray(lexPath);
dicPath.clear(); dicPath = null;
}
boolean loadpos = dicJson.has("loadpos")
? dicJson.getBoolean("loadpos") : true;
boolean loadpinyin = dicJson.has("loadpinyin")
? dicJson.getBoolean("loadpinyin") : true;
boolean loadsyn = dicJson.has("loadsyn")
? dicJson.getBoolean("loadsyn") : true;
boolean loadentity = dicJson.has("loadentity")
? dicJson.getBoolean("loadentity") : true;
boolean autoload = dicJson.has("autoload")
? dicJson.getBoolean("autoload") : false;
int polltime = dicJson.has("polltime")
? dicJson.getInt("polltime") : 300;
dictLoadConfig.setLoadCJKPinyin(loadpinyin);
dictLoadConfig.setLoadCJKPos(loadpos);
dictLoadConfig.setLoadCJKSyn(loadsyn);
dictLoadConfig.setLoadEntity(loadentity);
dictLoadConfig.setAutoload(autoload);
dictLoadConfig.setPollTime(polltime);
dictLoadConfig.setLexiconPath(lexPath);
ADictionary dic = DictionaryFactory.createDefaultDictionary(dictLoadConfig);
resourcePool.addDict(name, dic);
}
}
dictLoadConfig = null;
/*
* create the JcsegTaskConfig instance according to the definition config
*/
if ( globalConfig.has("jcseg_config") ) {
JSONObject configSetting = globalConfig.getJSONObject("jcseg_config");
String[] configNames = JSONObject.getNames(configSetting);
for ( String name : configNames ) {
JSONObject configJson = configSetting.getJSONObject(name);
SegmenterConfig config = globalJcsegTaskConfig.clone();
if ( configJson.length() > 0 ) {
resetJcsegTaskConfig(config, configJson);
}
resourcePool.addConfig(name, config);
}
}
/*
* create the tokenizer instance according the definition of tokenizer
*/
if ( globalConfig.has("jcseg_tokenizer") ) {
JSONObject tokenizerSetting = globalConfig.getJSONObject("jcseg_tokenizer");
String[] tokenizerNames = JSONObject.getNames(tokenizerSetting);
for ( String name : tokenizerNames ) {
JSONObject tokenizerJson = tokenizerSetting.getJSONObject(name);
int algorithm = tokenizerJson.has("algorithm")
? tokenizerJson.getInt("algorithm") : ISegment.COMPLEX_MODE;
if ( ! tokenizerJson.has("dict") ) {
throw new IllegalArgumentException("Missing dict setting for tokenizer " + name);
}
if ( ! tokenizerJson.has("config") ) {
throw new IllegalArgumentException("Missing config setting for tokenizer " + name);
}
ADictionary dic = resourcePool.getDict(tokenizerJson.getString("dict"));
SegmenterConfig config = resourcePool.getConfig(tokenizerJson.getString("config"));
if ( dic == null ) {
throw new IllegalArgumentException("Unknow dict instance "
+ tokenizerJson.getString("dict") + " for tokenizer " + name);
}
if ( config == null ) {
throw new IllegalArgumentException("Unknow config instance "
+ tokenizerJson.getString("config") + " for tokenizer " + name);
}
resourcePool.addTokenizerEntry(name, new JcsegTokenizerEntry(algorithm, config, dic));
}
}
init();
return this;
} | [
"public",
"JcsegServer",
"initFromGlobalConfig",
"(",
"JSONObject",
"globalConfig",
")",
"throws",
"CloneNotSupportedException",
"{",
"/*\n * parse and initialize the server according to the global config\n */",
"if",
"(",
"globalConfig",
".",
"has",
"(",
"\"server_config\"",
")",
")",
"{",
"JSONObject",
"serverSetting",
"=",
"globalConfig",
".",
"getJSONObject",
"(",
"\"server_config\"",
")",
";",
"if",
"(",
"serverSetting",
".",
"has",
"(",
"\"host\"",
")",
")",
"{",
"config",
".",
"setHost",
"(",
"serverSetting",
".",
"getString",
"(",
"\"host\"",
")",
")",
";",
"}",
"if",
"(",
"serverSetting",
".",
"has",
"(",
"\"port\"",
")",
")",
"{",
"config",
".",
"setPort",
"(",
"serverSetting",
".",
"getInt",
"(",
"\"port\"",
")",
")",
";",
"}",
"if",
"(",
"serverSetting",
".",
"has",
"(",
"\"charset\"",
")",
")",
"{",
"config",
".",
"setCharset",
"(",
"serverSetting",
".",
"getString",
"(",
"\"charset\"",
")",
")",
";",
"}",
"if",
"(",
"serverSetting",
".",
"has",
"(",
"\"max_thread_pool_size\"",
")",
")",
"{",
"config",
".",
"setMaxThreadPoolSize",
"(",
"serverSetting",
".",
"getInt",
"(",
"\"max_thread_pool_size\"",
")",
")",
";",
"}",
"if",
"(",
"serverSetting",
".",
"has",
"(",
"\"thread_idle_timeout\"",
")",
")",
"{",
"config",
".",
"setThreadIdleTimeout",
"(",
"serverSetting",
".",
"getInt",
"(",
"\"thread_idle_timeout\"",
")",
")",
";",
"}",
"if",
"(",
"serverSetting",
".",
"has",
"(",
"\"http_output_buffer_size\"",
")",
")",
"{",
"config",
".",
"setOutputBufferSize",
"(",
"serverSetting",
".",
"getInt",
"(",
"\"http_output_buffer_size\"",
")",
")",
";",
"}",
"if",
"(",
"serverSetting",
".",
"has",
"(",
"\"http_request_header_size\"",
")",
")",
"{",
"config",
".",
"setRequestHeaderSize",
"(",
"serverSetting",
".",
"getInt",
"(",
"\"http_request_header_size\"",
")",
")",
";",
"}",
"if",
"(",
"serverSetting",
".",
"has",
"(",
"\"http_response_header_size\"",
")",
")",
"{",
"config",
".",
"setResponseHeaderSize",
"(",
"serverSetting",
".",
"getInt",
"(",
"\"http_connection_idle_timeout\"",
")",
")",
";",
"}",
"}",
"SegmenterConfig",
"globalJcsegTaskConfig",
"=",
"new",
"SegmenterConfig",
"(",
"false",
")",
";",
"if",
"(",
"globalConfig",
".",
"has",
"(",
"\"jcseg_global_config\"",
")",
")",
"{",
"JSONObject",
"globalSetting",
"=",
"globalConfig",
".",
"getJSONObject",
"(",
"\"jcseg_global_config\"",
")",
";",
"resetJcsegTaskConfig",
"(",
"globalJcsegTaskConfig",
",",
"globalSetting",
")",
";",
"}",
"/*\n * create the dictionaries according to the definition of dict \n * and we will make a copy of the globalSetting for dictionary load\n * \n * reset the max length to pass the dictionary words length limitation\n */",
"SegmenterConfig",
"dictLoadConfig",
"=",
"globalJcsegTaskConfig",
".",
"clone",
"(",
")",
";",
"dictLoadConfig",
".",
"setMaxLength",
"(",
"100",
")",
";",
"if",
"(",
"globalConfig",
".",
"has",
"(",
"\"jcseg_dict\"",
")",
")",
"{",
"JSONObject",
"dictSetting",
"=",
"globalConfig",
".",
"getJSONObject",
"(",
"\"jcseg_dict\"",
")",
";",
"String",
"[",
"]",
"dictNames",
"=",
"JSONObject",
".",
"getNames",
"(",
"dictSetting",
")",
";",
"for",
"(",
"String",
"name",
":",
"dictNames",
")",
"{",
"JSONObject",
"dicJson",
"=",
"dictSetting",
".",
"getJSONObject",
"(",
"name",
")",
";",
"if",
"(",
"!",
"dicJson",
".",
"has",
"(",
"\"path\"",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Missing path for dict instance \"",
"+",
"name",
")",
";",
"}",
"String",
"[",
"]",
"lexPath",
"=",
"null",
";",
"if",
"(",
"!",
"dicJson",
".",
"isNull",
"(",
"\"path\"",
")",
")",
"{",
"JSONArray",
"path",
"=",
"dicJson",
".",
"getJSONArray",
"(",
"\"path\"",
")",
";",
"List",
"<",
"String",
">",
"dicPath",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"path",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"String",
"filePath",
"=",
"path",
".",
"get",
"(",
"i",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"filePath",
".",
"indexOf",
"(",
"\"{jar.dir}\"",
")",
">",
"-",
"1",
")",
"{",
"filePath",
"=",
"filePath",
".",
"replace",
"(",
"\"{jar.dir}\"",
",",
"Util",
".",
"getJarHome",
"(",
"this",
")",
")",
";",
"}",
"dicPath",
".",
"add",
"(",
"filePath",
")",
";",
"}",
"lexPath",
"=",
"new",
"String",
"[",
"dicPath",
".",
"size",
"(",
")",
"]",
";",
"dicPath",
".",
"toArray",
"(",
"lexPath",
")",
";",
"dicPath",
".",
"clear",
"(",
")",
";",
"dicPath",
"=",
"null",
";",
"}",
"boolean",
"loadpos",
"=",
"dicJson",
".",
"has",
"(",
"\"loadpos\"",
")",
"?",
"dicJson",
".",
"getBoolean",
"(",
"\"loadpos\"",
")",
":",
"true",
";",
"boolean",
"loadpinyin",
"=",
"dicJson",
".",
"has",
"(",
"\"loadpinyin\"",
")",
"?",
"dicJson",
".",
"getBoolean",
"(",
"\"loadpinyin\"",
")",
":",
"true",
";",
"boolean",
"loadsyn",
"=",
"dicJson",
".",
"has",
"(",
"\"loadsyn\"",
")",
"?",
"dicJson",
".",
"getBoolean",
"(",
"\"loadsyn\"",
")",
":",
"true",
";",
"boolean",
"loadentity",
"=",
"dicJson",
".",
"has",
"(",
"\"loadentity\"",
")",
"?",
"dicJson",
".",
"getBoolean",
"(",
"\"loadentity\"",
")",
":",
"true",
";",
"boolean",
"autoload",
"=",
"dicJson",
".",
"has",
"(",
"\"autoload\"",
")",
"?",
"dicJson",
".",
"getBoolean",
"(",
"\"autoload\"",
")",
":",
"false",
";",
"int",
"polltime",
"=",
"dicJson",
".",
"has",
"(",
"\"polltime\"",
")",
"?",
"dicJson",
".",
"getInt",
"(",
"\"polltime\"",
")",
":",
"300",
";",
"dictLoadConfig",
".",
"setLoadCJKPinyin",
"(",
"loadpinyin",
")",
";",
"dictLoadConfig",
".",
"setLoadCJKPos",
"(",
"loadpos",
")",
";",
"dictLoadConfig",
".",
"setLoadCJKSyn",
"(",
"loadsyn",
")",
";",
"dictLoadConfig",
".",
"setLoadEntity",
"(",
"loadentity",
")",
";",
"dictLoadConfig",
".",
"setAutoload",
"(",
"autoload",
")",
";",
"dictLoadConfig",
".",
"setPollTime",
"(",
"polltime",
")",
";",
"dictLoadConfig",
".",
"setLexiconPath",
"(",
"lexPath",
")",
";",
"ADictionary",
"dic",
"=",
"DictionaryFactory",
".",
"createDefaultDictionary",
"(",
"dictLoadConfig",
")",
";",
"resourcePool",
".",
"addDict",
"(",
"name",
",",
"dic",
")",
";",
"}",
"}",
"dictLoadConfig",
"=",
"null",
";",
"/*\n * create the JcsegTaskConfig instance according to the definition config\n */",
"if",
"(",
"globalConfig",
".",
"has",
"(",
"\"jcseg_config\"",
")",
")",
"{",
"JSONObject",
"configSetting",
"=",
"globalConfig",
".",
"getJSONObject",
"(",
"\"jcseg_config\"",
")",
";",
"String",
"[",
"]",
"configNames",
"=",
"JSONObject",
".",
"getNames",
"(",
"configSetting",
")",
";",
"for",
"(",
"String",
"name",
":",
"configNames",
")",
"{",
"JSONObject",
"configJson",
"=",
"configSetting",
".",
"getJSONObject",
"(",
"name",
")",
";",
"SegmenterConfig",
"config",
"=",
"globalJcsegTaskConfig",
".",
"clone",
"(",
")",
";",
"if",
"(",
"configJson",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"resetJcsegTaskConfig",
"(",
"config",
",",
"configJson",
")",
";",
"}",
"resourcePool",
".",
"addConfig",
"(",
"name",
",",
"config",
")",
";",
"}",
"}",
"/*\n * create the tokenizer instance according the definition of tokenizer\n */",
"if",
"(",
"globalConfig",
".",
"has",
"(",
"\"jcseg_tokenizer\"",
")",
")",
"{",
"JSONObject",
"tokenizerSetting",
"=",
"globalConfig",
".",
"getJSONObject",
"(",
"\"jcseg_tokenizer\"",
")",
";",
"String",
"[",
"]",
"tokenizerNames",
"=",
"JSONObject",
".",
"getNames",
"(",
"tokenizerSetting",
")",
";",
"for",
"(",
"String",
"name",
":",
"tokenizerNames",
")",
"{",
"JSONObject",
"tokenizerJson",
"=",
"tokenizerSetting",
".",
"getJSONObject",
"(",
"name",
")",
";",
"int",
"algorithm",
"=",
"tokenizerJson",
".",
"has",
"(",
"\"algorithm\"",
")",
"?",
"tokenizerJson",
".",
"getInt",
"(",
"\"algorithm\"",
")",
":",
"ISegment",
".",
"COMPLEX_MODE",
";",
"if",
"(",
"!",
"tokenizerJson",
".",
"has",
"(",
"\"dict\"",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Missing dict setting for tokenizer \"",
"+",
"name",
")",
";",
"}",
"if",
"(",
"!",
"tokenizerJson",
".",
"has",
"(",
"\"config\"",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Missing config setting for tokenizer \"",
"+",
"name",
")",
";",
"}",
"ADictionary",
"dic",
"=",
"resourcePool",
".",
"getDict",
"(",
"tokenizerJson",
".",
"getString",
"(",
"\"dict\"",
")",
")",
";",
"SegmenterConfig",
"config",
"=",
"resourcePool",
".",
"getConfig",
"(",
"tokenizerJson",
".",
"getString",
"(",
"\"config\"",
")",
")",
";",
"if",
"(",
"dic",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unknow dict instance \"",
"+",
"tokenizerJson",
".",
"getString",
"(",
"\"dict\"",
")",
"+",
"\" for tokenizer \"",
"+",
"name",
")",
";",
"}",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unknow config instance \"",
"+",
"tokenizerJson",
".",
"getString",
"(",
"\"config\"",
")",
"+",
"\" for tokenizer \"",
"+",
"name",
")",
";",
"}",
"resourcePool",
".",
"addTokenizerEntry",
"(",
"name",
",",
"new",
"JcsegTokenizerEntry",
"(",
"algorithm",
",",
"config",
",",
"dic",
")",
")",
";",
"}",
"}",
"init",
"(",
")",
";",
"return",
"this",
";",
"}"
] | load configuration. | [
"load",
"configuration",
"."
] | [
"//create a global JcsegTaskConfig and initialize from the global_setting",
"//process the lexPath",
"//create and register the global dictionary resource",
"//clone the globalJcsegTaskConfig",
"//and do the override working by local defination",
"//register the global resource",
"//now, initialize the server"
] | [
{
"param": "globalConfig",
"type": "JSONObject"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "globalConfig",
"type": "JSONObject",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
804,
71,
5680,
2081,
1208,
1265,
5160,
809,
12,
2986,
921,
2552,
809,
13,
1216,
12758,
25482,
203,
565,
288,
203,
3639,
1748,
203,
540,
380,
1109,
471,
4046,
326,
1438,
4888,
358,
326,
2552,
642,
203,
3639,
1195,
203,
3639,
309,
261,
2552,
809,
18,
5332,
2932,
3567,
67,
1425,
7923,
262,
288,
203,
5411,
8014,
1438,
5568,
273,
2552,
809,
18,
588,
2986,
921,
2932,
3567,
67,
1425,
8863,
203,
5411,
309,
261,
1438,
5568,
18,
5332,
2932,
2564,
7923,
262,
288,
203,
7734,
642,
18,
542,
2594,
12,
3567,
5568,
18,
588,
780,
2932,
2564,
7923,
1769,
203,
5411,
289,
203,
5411,
309,
261,
1438,
5568,
18,
5332,
2932,
655,
7923,
262,
288,
203,
7734,
642,
18,
542,
2617,
12,
3567,
5568,
18,
588,
1702,
2932,
655,
7923,
1769,
203,
5411,
289,
203,
5411,
309,
261,
1438,
5568,
18,
5332,
2932,
9999,
7923,
262,
288,
203,
7734,
642,
18,
542,
9652,
12,
3567,
5568,
18,
588,
780,
2932,
9999,
7923,
1769,
7010,
5411,
289,
203,
5411,
309,
261,
1438,
5568,
18,
5332,
2932,
1896,
67,
5930,
67,
6011,
67,
1467,
7923,
262,
288,
203,
7734,
642,
18,
542,
2747,
3830,
18834,
12,
3567,
5568,
18,
588,
1702,
2932,
1896,
67,
5930,
67,
6011,
67,
1467,
7923,
1769,
203,
5411,
289,
203,
5411,
309,
261,
1438,
5568,
18,
5332,
2932,
5930,
67,
20390,
67,
4538,
7923,
262,
288,
203,
7734,
642,
18,
542,
3830,
13834,
2694,
12,
3567,
5568,
18,
588,
1702,
2932,
5930,
67,
20390,
67,
4538,
7923,
1769,
203,
5411,
289,
203,
5411,
309,
261,
1438,
5568,
18,
5332,
2932,
2505,
67,
2844,
67,
4106,
67,
1467,
7923,
262,
288,
203,
7734,
642,
18,
542,
1447,
15384,
12,
3567,
5568,
18,
588,
1702,
2932,
2505,
67,
2844,
67,
4106,
67,
1467,
7923,
1769,
203,
5411,
289,
203,
5411,
309,
261,
1438,
5568,
18,
5332,
2932,
2505,
67,
2293,
67,
3374,
67,
1467,
7923,
262,
288,
203,
7734,
642,
18,
542,
691,
1864,
1225,
12,
3567,
5568,
18,
588,
1702,
2932,
2505,
67,
2293,
67,
3374,
67,
1467,
7923,
1769,
203,
5411,
289,
203,
5411,
309,
261,
1438,
5568,
18,
5332,
2932,
2505,
67,
2740,
67,
3374,
67,
1467,
7923,
262,
288,
203,
7734,
642,
18,
542,
1064,
1864,
1225,
12,
3567,
5568,
18,
588,
1702,
2932,
2505,
67,
4071,
67,
20390,
67,
4538,
7923,
1769,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
368,
2640,
279,
2552,
804,
71,
5680,
2174,
809,
471,
4046,
628,
326,
2552,
67,
8920,
203,
3639,
10807,
264,
809,
2552,
46,
71,
5680,
2174,
809,
273,
394,
10807,
264,
809,
12,
5743,
1769,
203,
3639,
309,
261,
2552,
809,
18,
5332,
2932,
78,
71,
5680,
67,
6347,
67,
1425,
7923,
262,
288,
203,
5411,
8014,
2552,
5568,
273,
2552,
809,
18,
588,
2986,
921,
2932,
78,
71,
5680,
67,
6347,
67,
1425,
8863,
203,
5411,
2715,
46,
71,
5680,
2174,
809,
12,
6347,
46,
71,
5680,
2174,
809,
16,
2552,
5568,
1769,
203,
3639,
289,
203,
540,
203,
3639,
1748,
203,
540,
380,
752,
326,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
1262,
1664,
18,
203,
377,
380,
404,
18,
4046,
326,
1438,
642,
203,
377,
380,
576,
18,
1744,
2552,
1058,
261,
6347,
1058,
4046,
13,
203,
377,
380,
7010,
377,
380,
632,
891,
225,
2552,
809,
203,
377,
380,
632,
2463,
804,
71,
5680,
2081,
203,
377,
380,
632,
15069,
12758,
25482,
7010,
377,
380,
632,
15069,
804,
71,
5680,
503,
7010,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
15ba4e002daafd4104849559ab2c9d840553eab7 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/TimeUtil.java | [
"Apache-2.0"
] | Java | createDateTimePool | null | public static final IWord[] createDateTimePool()
{
return new IWord[]{
null, //year
null, //month
null, //day
null, //timing method
null, //hour
null, //minute
null, //seconds
};
} | /**
* create and return a date-time pool
*
* @return IWord[]
*/ | create and return a date-time pool
| [
"create",
"and",
"return",
"a",
"date",
"-",
"time",
"pool"
] | public static final IWord[] createDateTimePool()
{
return new IWord[]{
null,
null,
null,
null,
null,
null,
null,
};
} | [
"public",
"static",
"final",
"IWord",
"[",
"]",
"createDateTimePool",
"(",
")",
"{",
"return",
"new",
"IWord",
"[",
"]",
"{",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"}",
";",
"}"
] | create and return a date-time pool | [
"create",
"and",
"return",
"a",
"date",
"-",
"time",
"pool"
] | [
"//year",
"//month",
"//day",
"//timing method",
"//hour",
"//minute",
"//seconds"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
727,
467,
3944,
8526,
752,
5096,
2864,
1435,
203,
565,
288,
203,
3639,
327,
394,
467,
3944,
63,
7073,
203,
5411,
446,
16,
282,
368,
6874,
203,
5411,
446,
16,
282,
368,
7496,
203,
5411,
446,
16,
282,
368,
2881,
203,
5411,
446,
16,
282,
368,
8584,
310,
707,
203,
5411,
446,
16,
282,
368,
12091,
203,
5411,
446,
16,
282,
368,
17637,
203,
5411,
446,
16,
282,
368,
7572,
203,
3639,
289,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
752,
471,
327,
279,
1509,
17,
957,
2845,
203,
377,
380,
7010,
377,
380,
632,
2463,
225,
467,
3944,
8526,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
15ba4e002daafd4104849559ab2c9d840553eab7 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/TimeUtil.java | [
"Apache-2.0"
] | Java | fillDateTimePool | null | public static final int fillDateTimePool(IWord[] wPool, IWord word)
{
int pIdx = getDateTimeIndex(word.getEntity(0));
if ( pIdx == DATETIME_NONE ) {
return DATETIME_NONE;
}
if ( wPool[pIdx] == null ) {
wPool[pIdx] = word;
return pIdx;
}
return DATETIME_NONE;
} | /**
* fill the date-time pool specified part through the specified
* time entity string.
*
* @param wPool
* @param word
* @return int
*/ | fill the date-time pool specified part through the specified
time entity string.
@param wPool
@param word
@return int | [
"fill",
"the",
"date",
"-",
"time",
"pool",
"specified",
"part",
"through",
"the",
"specified",
"time",
"entity",
"string",
".",
"@param",
"wPool",
"@param",
"word",
"@return",
"int"
] | public static final int fillDateTimePool(IWord[] wPool, IWord word)
{
int pIdx = getDateTimeIndex(word.getEntity(0));
if ( pIdx == DATETIME_NONE ) {
return DATETIME_NONE;
}
if ( wPool[pIdx] == null ) {
wPool[pIdx] = word;
return pIdx;
}
return DATETIME_NONE;
} | [
"public",
"static",
"final",
"int",
"fillDateTimePool",
"(",
"IWord",
"[",
"]",
"wPool",
",",
"IWord",
"word",
")",
"{",
"int",
"pIdx",
"=",
"getDateTimeIndex",
"(",
"word",
".",
"getEntity",
"(",
"0",
")",
")",
";",
"if",
"(",
"pIdx",
"==",
"DATETIME_NONE",
")",
"{",
"return",
"DATETIME_NONE",
";",
"}",
"if",
"(",
"wPool",
"[",
"pIdx",
"]",
"==",
"null",
")",
"{",
"wPool",
"[",
"pIdx",
"]",
"=",
"word",
";",
"return",
"pIdx",
";",
"}",
"return",
"DATETIME_NONE",
";",
"}"
] | fill the date-time pool specified part through the specified
time entity string. | [
"fill",
"the",
"date",
"-",
"time",
"pool",
"specified",
"part",
"through",
"the",
"specified",
"time",
"entity",
"string",
"."
] | [] | [
{
"param": "wPool",
"type": "IWord[]"
},
{
"param": "word",
"type": "IWord"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "wPool",
"type": "IWord[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "word",
"type": "IWord",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
727,
509,
3636,
5096,
2864,
12,
45,
3944,
8526,
341,
2864,
16,
467,
3944,
2076,
13,
203,
565,
288,
203,
3639,
509,
293,
4223,
273,
25562,
1016,
12,
1095,
18,
588,
1943,
12,
20,
10019,
203,
3639,
309,
261,
293,
4223,
422,
31337,
67,
9826,
262,
288,
203,
5411,
327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2463,
225,
509,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
15ba4e002daafd4104849559ab2c9d840553eab7 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/TimeUtil.java | [
"Apache-2.0"
] | Java | fillDateTimePool | null | public static final void fillDateTimePool(
IWord[] wPool, int pIdx, IWord word)
{
if ( wPool[pIdx] == null ) {
wPool[pIdx] = word;
}
} | /**
* fill the date-time pool specified part with part index constant
*
* @param wPool
* @param pIdx
* @param word
*/ | fill the date-time pool specified part with part index constant
| [
"fill",
"the",
"date",
"-",
"time",
"pool",
"specified",
"part",
"with",
"part",
"index",
"constant"
] | public static final void fillDateTimePool(
IWord[] wPool, int pIdx, IWord word)
{
if ( wPool[pIdx] == null ) {
wPool[pIdx] = word;
}
} | [
"public",
"static",
"final",
"void",
"fillDateTimePool",
"(",
"IWord",
"[",
"]",
"wPool",
",",
"int",
"pIdx",
",",
"IWord",
"word",
")",
"{",
"if",
"(",
"wPool",
"[",
"pIdx",
"]",
"==",
"null",
")",
"{",
"wPool",
"[",
"pIdx",
"]",
"=",
"word",
";",
"}",
"}"
] | fill the date-time pool specified part with part index constant | [
"fill",
"the",
"date",
"-",
"time",
"pool",
"specified",
"part",
"with",
"part",
"index",
"constant"
] | [] | [
{
"param": "wPool",
"type": "IWord[]"
},
{
"param": "pIdx",
"type": "int"
},
{
"param": "word",
"type": "IWord"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "wPool",
"type": "IWord[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pIdx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "word",
"type": "IWord",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
727,
918,
3636,
5096,
2864,
12,
203,
5411,
467,
3944,
8526,
341,
2864,
16,
509,
293,
4223,
16,
467,
3944,
2076,
13,
203,
565,
288,
203,
3639,
309,
261,
341,
2864,
63,
84,
4223,
65,
422,
446,
262,
288,
203,
5411,
341,
2864,
63,
84,
4223,
65,
273,
2076,
31,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
3636,
326,
1509,
17,
957,
2845,
1269,
1087,
598,
1087,
770,
5381,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
341,
2864,
203,
377,
380,
632,
891,
282,
293,
4223,
203,
377,
380,
632,
891,
282,
2076,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
5a278608599a98c833bf3196647a0e454e78f93f | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/segmenter/NLPSeg.java | [
"Apache-2.0"
] | Java | next | IWord | public IWord next() throws IOException
{
if ( eWordPool.size() > 0 ) {
return eWordPool.removeFirst();
}
IWord word = super.next();
if ( word == null ) {
return null;
}
String[] entity = word.getEntity();
/*
* This is a temporary program for
* the_number or the_episode entity recognition.
* ignore this if the entity is not null
* added at 2017/05/25
*/
if ( entity == null && word.getValue().charAt(0) == '第' ) {
IWord dWord = getNextTheWord(word);
if ( dWord != null ) {
dWord.setPartSpeechForNull(IWord.QUANTIFIER);
return dWord;
}
}
if ( entity == null ) {
return word;
}
int eIdx = 0;
if ( (eIdx = ArrayUtil.startsWith("time.a", entity)) > -1
|| (eIdx = ArrayUtil.startsWith(
Entity.E_DATETIME_P, entity)) > -1 ) {
IWord dWord = getNextTimeMergedWord(word, eIdx);
if ( dWord != null ) {
return dWord;
}
}
if ( (eIdx = ArrayUtil.startsWith("datetime.ymd", entity)) > -1 ) {
IWord dWord = getNextDatetimeWord(word, eIdx);
if ( dWord != null ) {
return dWord;
}
}
return word;
} | /**
* Override the next method to add the date-time entity recognition
* And we also invoke the parent.next method to get the next token
*
* @see Segmenter#next()
* @throws IOException
*/ | Override the next method to add the date-time entity recognition
And we also invoke the parent.next method to get the next token
@see Segmenter#next()
@throws IOException | [
"Override",
"the",
"next",
"method",
"to",
"add",
"the",
"date",
"-",
"time",
"entity",
"recognition",
"And",
"we",
"also",
"invoke",
"the",
"parent",
".",
"next",
"method",
"to",
"get",
"the",
"next",
"token",
"@see",
"Segmenter#next",
"()",
"@throws",
"IOException"
] | public IWord next() throws IOException
{
if ( eWordPool.size() > 0 ) {
return eWordPool.removeFirst();
}
IWord word = super.next();
if ( word == null ) {
return null;
}
String[] entity = word.getEntity();
/*
* This is a temporary program for
* the_number or the_episode entity recognition.
* ignore this if the entity is not null
* added at 2017/05/25
*/
if ( entity == null && word.getValue().charAt(0) == '第' ) {
IWord dWord = getNextTheWord(word);
if ( dWord != null ) {
dWord.setPartSpeechForNull(IWord.QUANTIFIER);
return dWord;
}
}
if ( entity == null ) {
return word;
}
int eIdx = 0;
if ( (eIdx = ArrayUtil.startsWith("time.a", entity)) > -1
|| (eIdx = ArrayUtil.startsWith(
Entity.E_DATETIME_P, entity)) > -1 ) {
IWord dWord = getNextTimeMergedWord(word, eIdx);
if ( dWord != null ) {
return dWord;
}
}
if ( (eIdx = ArrayUtil.startsWith("datetime.ymd", entity)) > -1 ) {
IWord dWord = getNextDatetimeWord(word, eIdx);
if ( dWord != null ) {
return dWord;
}
}
return word;
} | [
"public",
"IWord",
"next",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"eWordPool",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"return",
"eWordPool",
".",
"removeFirst",
"(",
")",
";",
"}",
"IWord",
"word",
"=",
"super",
".",
"next",
"(",
")",
";",
"if",
"(",
"word",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"[",
"]",
"entity",
"=",
"word",
".",
"getEntity",
"(",
")",
";",
"/*\n * This is a temporary program for\n * the_number or the_episode entity recognition.\n * ignore this if the entity is not null\n * added at 2017/05/25\n */",
"if",
"(",
"entity",
"==",
"null",
"&&",
"word",
".",
"getValue",
"(",
")",
".",
"charAt",
"(",
"0",
")",
"==",
"'第' )",
"{",
"",
"IWord",
"dWord",
"=",
"getNextTheWord",
"(",
"word",
")",
";",
"if",
"(",
"dWord",
"!=",
"null",
")",
"{",
"dWord",
".",
"setPartSpeechForNull",
"(",
"IWord",
".",
"QUANTIFIER",
")",
";",
"return",
"dWord",
";",
"}",
"}",
"if",
"(",
"entity",
"==",
"null",
")",
"{",
"return",
"word",
";",
"}",
"int",
"eIdx",
"=",
"0",
";",
"if",
"(",
"(",
"eIdx",
"=",
"ArrayUtil",
".",
"startsWith",
"(",
"\"time.a\"",
",",
"entity",
")",
")",
">",
"-",
"1",
"||",
"(",
"eIdx",
"=",
"ArrayUtil",
".",
"startsWith",
"(",
"Entity",
".",
"E_DATETIME_P",
",",
"entity",
")",
")",
">",
"-",
"1",
")",
"{",
"IWord",
"dWord",
"=",
"getNextTimeMergedWord",
"(",
"word",
",",
"eIdx",
")",
";",
"if",
"(",
"dWord",
"!=",
"null",
")",
"{",
"return",
"dWord",
";",
"}",
"}",
"if",
"(",
"(",
"eIdx",
"=",
"ArrayUtil",
".",
"startsWith",
"(",
"\"datetime.ymd\"",
",",
"entity",
")",
")",
">",
"-",
"1",
")",
"{",
"IWord",
"dWord",
"=",
"getNextDatetimeWord",
"(",
"word",
",",
"eIdx",
")",
";",
"if",
"(",
"dWord",
"!=",
"null",
")",
"{",
"return",
"dWord",
";",
"}",
"}",
"return",
"word",
";",
"}"
] | Override the next method to add the date-time entity recognition
And we also invoke the parent.next method to get the next token | [
"Override",
"the",
"next",
"method",
"to",
"add",
"the",
"date",
"-",
"time",
"entity",
"recognition",
"And",
"we",
"also",
"invoke",
"the",
"parent",
".",
"next",
"method",
"to",
"get",
"the",
"next",
"token"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
467,
3944,
1024,
1435,
1216,
1860,
203,
565,
288,
203,
3639,
309,
261,
425,
3944,
2864,
18,
1467,
1435,
405,
374,
262,
288,
203,
5411,
327,
425,
3944,
2864,
18,
4479,
3759,
5621,
203,
3639,
289,
203,
203,
3639,
467,
3944,
2076,
273,
2240,
18,
4285,
5621,
203,
3639,
309,
261,
2076,
422,
446,
262,
288,
203,
5411,
327,
446,
31,
203,
3639,
289,
203,
203,
3639,
514,
8526,
1522,
273,
2076,
18,
588,
1943,
5621,
203,
203,
3639,
1748,
203,
540,
380,
1220,
353,
279,
6269,
5402,
364,
203,
540,
380,
326,
67,
2696,
578,
326,
67,
29687,
1522,
1950,
7909,
18,
203,
540,
380,
2305,
333,
309,
326,
1522,
353,
486,
446,
203,
540,
380,
3096,
622,
11015,
19,
6260,
19,
2947,
203,
3639,
1195,
203,
3639,
309,
261,
1522,
422,
446,
597,
2076,
18,
24805,
7675,
3001,
861,
12,
20,
13,
422,
296,
168,
110,
110,
11,
262,
288,
203,
5411,
467,
3944,
302,
3944,
273,
6927,
1986,
3944,
12,
1095,
1769,
203,
5411,
309,
261,
302,
3944,
480,
446,
262,
288,
203,
7734,
302,
3944,
18,
542,
1988,
22334,
1290,
2041,
12,
45,
3944,
18,
3500,
6856,
10591,
1769,
203,
7734,
327,
302,
3944,
31,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
309,
261,
1522,
422,
446,
262,
288,
203,
5411,
327,
2076,
31,
203,
3639,
289,
203,
203,
3639,
509,
425,
4223,
273,
374,
31,
203,
3639,
309,
261,
261,
73,
4223,
273,
27207,
18,
17514,
1190,
2932,
957,
18,
69,
3113,
1522,
3719,
405,
300,
21,
203,
540,
202,
202,
20081,
261,
73,
4223,
273,
27207,
18,
17514,
1190,
12,
203,
540,
9506,
202,
1943,
18,
41,
67,
22968,
67,
52,
16,
1522,
3719,
405,
300,
21,
262,
288,
203,
5411,
467,
3944,
302,
3944,
273,
6927,
950,
19043,
3944,
12,
1095,
16,
425,
4223,
1769,
203,
5411,
309,
261,
302,
3944,
480,
446,
262,
288,
203,
7734,
327,
302,
3944,
31,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
309,
261,
261,
73,
4223,
273,
27207,
18,
17514,
1190,
2932,
6585,
18,
93,
1264,
3113,
1522,
3719,
405,
300,
21,
262,
288,
203,
5411,
467,
3944,
302,
3944,
273,
6927,
16103,
3944,
12,
1095,
16,
425,
4223,
1769,
203,
5411,
309,
261,
302,
3944,
480,
446,
262,
288,
203,
7734,
327,
302,
3944,
31,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
327,
2076,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1439,
326,
1024,
707,
358,
527,
326,
1509,
17,
957,
1522,
1950,
7909,
203,
377,
380,
7835,
732,
2546,
4356,
326,
982,
18,
4285,
707,
358,
336,
326,
1024,
1147,
203,
377,
380,
203,
377,
380,
632,
5946,
10807,
264,
7,
4285,
1435,
203,
377,
380,
632,
15069,
1860,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c223ffcdb29bbeb9539b636b6363ffa9083fbae4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java | [
"Apache-2.0"
] | Java | isEnChar | null | public static boolean isEnChar( int c )
{
/*int type = Character.getType(c);
Character.UnicodeBlock cu = Character.UnicodeBlock.of(c);
if ( ! Character.isWhitespace(c) &&
(cu == Character.UnicodeBlock.BASIC_LATIN
|| type == Character.DECIMAL_DIGIT_NUMBER
|| type == Character.LOWERCASE_LETTER
|| type == Character.UPPERCASE_LETTER
|| type == Character.TITLECASE_LETTER
|| type == Character.MODIFIER_LETTER))
return true;
return false;*/
return ( StringUtil.isHWEnChar(c) || StringUtil.isFWEnChar(c) );
} | /**
* check the specified char is a basic Latin and Russia and
* Greece letter. True will be return if it is or return false.
* this method can recognize full-width char and letter
*
* @param c
* @return boolean
*/ | check the specified char is a basic Latin and Russia and
Greece letter. True will be return if it is or return false.
this method can recognize full-width char and letter
@param c
@return boolean | [
"check",
"the",
"specified",
"char",
"is",
"a",
"basic",
"Latin",
"and",
"Russia",
"and",
"Greece",
"letter",
".",
"True",
"will",
"be",
"return",
"if",
"it",
"is",
"or",
"return",
"false",
".",
"this",
"method",
"can",
"recognize",
"full",
"-",
"width",
"char",
"and",
"letter",
"@param",
"c",
"@return",
"boolean"
] | public static boolean isEnChar( int c )
{
/*int type = Character.getType(c);
Character.UnicodeBlock cu = Character.UnicodeBlock.of(c);
if ( ! Character.isWhitespace(c) &&
(cu == Character.UnicodeBlock.BASIC_LATIN
|| type == Character.DECIMAL_DIGIT_NUMBER
|| type == Character.LOWERCASE_LETTER
|| type == Character.UPPERCASE_LETTER
|| type == Character.TITLECASE_LETTER
|| type == Character.MODIFIER_LETTER))
return true;
return false;*/
return ( StringUtil.isHWEnChar(c) || StringUtil.isFWEnChar(c) );
} | [
"public",
"static",
"boolean",
"isEnChar",
"(",
"int",
"c",
")",
"{",
"/*int type = Character.getType(c);\n Character.UnicodeBlock cu = Character.UnicodeBlock.of(c);\n if ( ! Character.isWhitespace(c) && \n (cu == Character.UnicodeBlock.BASIC_LATIN\n || type == Character.DECIMAL_DIGIT_NUMBER\n || type == Character.LOWERCASE_LETTER\n || type == Character.UPPERCASE_LETTER\n || type == Character.TITLECASE_LETTER\n || type == Character.MODIFIER_LETTER)) \n return true;\n return false;*/",
"return",
"(",
"StringUtil",
".",
"isHWEnChar",
"(",
"c",
")",
"||",
"StringUtil",
".",
"isFWEnChar",
"(",
"c",
")",
")",
";",
"}"
] | check the specified char is a basic Latin and Russia and
Greece letter. | [
"check",
"the",
"specified",
"char",
"is",
"a",
"basic",
"Latin",
"and",
"Russia",
"and",
"Greece",
"letter",
"."
] | [] | [
{
"param": "c",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
353,
664,
2156,
12,
509,
276,
262,
7010,
565,
288,
203,
3639,
1748,
474,
618,
273,
6577,
18,
588,
559,
12,
71,
1769,
203,
3639,
6577,
18,
16532,
1768,
15985,
273,
6577,
18,
16532,
1768,
18,
792,
12,
71,
1769,
203,
3639,
309,
261,
401,
6577,
18,
291,
9431,
12,
71,
13,
597,
7010,
7734,
261,
6319,
422,
6577,
18,
16532,
1768,
18,
25642,
67,
20095,
203,
7734,
747,
618,
422,
6577,
18,
23816,
67,
21243,
1285,
67,
9931,
203,
7734,
747,
618,
422,
6577,
18,
23085,
13415,
67,
26379,
203,
7734,
747,
618,
422,
6577,
18,
31725,
13415,
67,
26379,
203,
7734,
747,
618,
422,
6577,
18,
14123,
13415,
67,
26379,
203,
7734,
747,
618,
422,
6577,
18,
6720,
10591,
67,
26379,
3719,
7010,
5411,
327,
638,
31,
203,
3639,
327,
629,
31,
5549,
203,
3639,
327,
261,
14205,
18,
291,
44,
59,
664,
2156,
12,
71,
13,
747,
14205,
18,
291,
29753,
664,
2156,
12,
71,
13,
11272,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
866,
326,
1269,
1149,
353,
279,
5337,
11134,
267,
471,
534,
5567,
1155,
471,
7010,
377,
380,
611,
992,
311,
9471,
18,
1053,
903,
506,
327,
309,
518,
353,
578,
327,
629,
18,
203,
377,
380,
333,
707,
848,
21431,
1983,
17,
2819,
1149,
471,
9471,
203,
377,
380,
7010,
377,
380,
632,
891,
276,
203,
377,
380,
632,
2463,
1250,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c223ffcdb29bbeb9539b636b6363ffa9083fbae4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java | [
"Apache-2.0"
] | Java | isFWEnChar | null | public static boolean isFWEnChar( int c )
{
return ( ( c >= 65296 && c <= 65305 )
|| ( c >= 65313 && c <= 65338 )
|| ( c >= 65345 && c < 65370) );
} | /**
* check the given char is a full-width char
* AT+reader: the full-width punctuation is not included here
*
* @param c
* @return boolean
*/ | check the given char is a full-width char
AT+reader: the full-width punctuation is not included here
@param c
@return boolean | [
"check",
"the",
"given",
"char",
"is",
"a",
"full",
"-",
"width",
"char",
"AT",
"+",
"reader",
":",
"the",
"full",
"-",
"width",
"punctuation",
"is",
"not",
"included",
"here",
"@param",
"c",
"@return",
"boolean"
] | public static boolean isFWEnChar( int c )
{
return ( ( c >= 65296 && c <= 65305 )
|| ( c >= 65313 && c <= 65338 )
|| ( c >= 65345 && c < 65370) );
} | [
"public",
"static",
"boolean",
"isFWEnChar",
"(",
"int",
"c",
")",
"{",
"return",
"(",
"(",
"c",
">=",
"65296",
"&&",
"c",
"<=",
"65305",
")",
"||",
"(",
"c",
">=",
"65313",
"&&",
"c",
"<=",
"65338",
")",
"||",
"(",
"c",
">=",
"65345",
"&&",
"c",
"<",
"65370",
")",
")",
";",
"}"
] | check the given char is a full-width char
AT+reader: the full-width punctuation is not included here | [
"check",
"the",
"given",
"char",
"is",
"a",
"full",
"-",
"width",
"char",
"AT",
"+",
"reader",
":",
"the",
"full",
"-",
"width",
"punctuation",
"is",
"not",
"included",
"here"
] | [] | [
{
"param": "c",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
17646,
59,
664,
2156,
12,
509,
276,
262,
203,
565,
288,
203,
3639,
327,
261,
261,
276,
1545,
15892,
5540,
26,
597,
276,
1648,
15892,
5082,
25,
262,
203,
7734,
747,
261,
276,
1545,
1666,
8643,
3437,
597,
276,
1648,
15892,
3707,
28,
262,
203,
7734,
747,
261,
276,
1545,
15892,
25574,
597,
276,
411,
15892,
6418,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
866,
326,
864,
1149,
353,
279,
1983,
17,
2819,
1149,
203,
377,
380,
14464,
15,
10530,
30,
326,
1983,
17,
2819,
22472,
353,
486,
5849,
2674,
203,
377,
380,
7010,
377,
380,
632,
891,
276,
203,
377,
380,
632,
2463,
1250,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c223ffcdb29bbeb9539b636b6363ffa9083fbae4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java | [
"Apache-2.0"
] | Java | isEnPunctuation | null | public static boolean isEnPunctuation( int c )
{
return ( (c > 32 && c < 48)
|| ( c > 57 && c < 65 )
|| ( c > 90 && c < 97 )
|| ( c > 122 && c < 127 )
);
} | /**
* check if the given char is half-width punctuation
*
* @param c
* @return boolean
*/ | check if the given char is half-width punctuation
@param c
@return boolean | [
"check",
"if",
"the",
"given",
"char",
"is",
"half",
"-",
"width",
"punctuation",
"@param",
"c",
"@return",
"boolean"
] | public static boolean isEnPunctuation( int c )
{
return ( (c > 32 && c < 48)
|| ( c > 57 && c < 65 )
|| ( c > 90 && c < 97 )
|| ( c > 122 && c < 127 )
);
} | [
"public",
"static",
"boolean",
"isEnPunctuation",
"(",
"int",
"c",
")",
"{",
"return",
"(",
"(",
"c",
">",
"32",
"&&",
"c",
"<",
"48",
")",
"||",
"(",
"c",
">",
"57",
"&&",
"c",
"<",
"65",
")",
"||",
"(",
"c",
">",
"90",
"&&",
"c",
"<",
"97",
")",
"||",
"(",
"c",
">",
"122",
"&&",
"c",
"<",
"127",
")",
")",
";",
"}"
] | check if the given char is half-width punctuation | [
"check",
"if",
"the",
"given",
"char",
"is",
"half",
"-",
"width",
"punctuation"
] | [] | [
{
"param": "c",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
353,
664,
52,
15726,
12,
509,
276,
262,
203,
565,
288,
203,
3639,
327,
261,
261,
71,
405,
3847,
597,
276,
411,
9934,
13,
7010,
7734,
747,
261,
276,
405,
15981,
597,
276,
411,
15892,
262,
203,
7734,
747,
261,
276,
405,
8566,
597,
276,
411,
16340,
262,
7010,
7734,
747,
261,
276,
405,
31501,
597,
276,
411,
12331,
262,
203,
3639,
11272,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
866,
309,
326,
864,
1149,
353,
8816,
17,
2819,
22472,
203,
377,
380,
7010,
377,
380,
632,
891,
276,
203,
377,
380,
632,
2463,
1250,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c223ffcdb29bbeb9539b636b6363ffa9083fbae4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java | [
"Apache-2.0"
] | Java | isDigit | null | public static boolean isDigit(String str, int beginIndex, int endIndex)
{
char c;
for ( int j = beginIndex; j < endIndex; j++ ) {
c = str.charAt(j);
//make full-width char half-width
if ( c > 65280 ) c -= 65248;
if ( c < 48 || c > 57 ) {
return false;
}
}
return true;
} | /**
* check the specified char is a digit or not
* true will return if it is or return false this method can recognize full-with char
*
* @param str
* @param beginIndex
* @param endIndex
* @return boolean
*/ | check the specified char is a digit or not
true will return if it is or return false this method can recognize full-with char
| [
"check",
"the",
"specified",
"char",
"is",
"a",
"digit",
"or",
"not",
"true",
"will",
"return",
"if",
"it",
"is",
"or",
"return",
"false",
"this",
"method",
"can",
"recognize",
"full",
"-",
"with",
"char"
] | public static boolean isDigit(String str, int beginIndex, int endIndex)
{
char c;
for ( int j = beginIndex; j < endIndex; j++ ) {
c = str.charAt(j);
if ( c > 65280 ) c -= 65248;
if ( c < 48 || c > 57 ) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isDigit",
"(",
"String",
"str",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"char",
"c",
";",
"for",
"(",
"int",
"j",
"=",
"beginIndex",
";",
"j",
"<",
"endIndex",
";",
"j",
"++",
")",
"{",
"c",
"=",
"str",
".",
"charAt",
"(",
"j",
")",
";",
"if",
"(",
"c",
">",
"65280",
")",
"c",
"-=",
"65248",
";",
"if",
"(",
"c",
"<",
"48",
"||",
"c",
">",
"57",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | check the specified char is a digit or not
true will return if it is or return false this method can recognize full-with char | [
"check",
"the",
"specified",
"char",
"is",
"a",
"digit",
"or",
"not",
"true",
"will",
"return",
"if",
"it",
"is",
"or",
"return",
"false",
"this",
"method",
"can",
"recognize",
"full",
"-",
"with",
"char"
] | [
"//make full-width char half-width"
] | [
{
"param": "str",
"type": "String"
},
{
"param": "beginIndex",
"type": "int"
},
{
"param": "endIndex",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "beginIndex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "endIndex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
29610,
12,
780,
609,
16,
509,
30929,
16,
509,
13818,
13,
203,
565,
288,
203,
3639,
1149,
276,
31,
203,
3639,
364,
261,
509,
525,
273,
30929,
31,
525,
411,
13818,
31,
525,
9904,
262,
288,
203,
5411,
276,
273,
609,
18,
3001,
861,
12,
78,
1769,
203,
5411,
368,
6540,
1983,
17,
2819,
1149,
8816,
17,
2819,
203,
5411,
309,
261,
276,
405,
1666,
9401,
3672,
262,
276,
3947,
15892,
3247,
28,
31,
203,
5411,
309,
261,
276,
411,
9934,
747,
276,
405,
15981,
262,
288,
203,
7734,
327,
629,
31,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
327,
638,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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1918,
1149,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
609,
203,
377,
380,
632,
891,
282,
30929,
203,
377,
380,
632,
891,
282,
13818,
203,
377,
380,
632,
2463,
225,
1250,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c223ffcdb29bbeb9539b636b6363ffa9083fbae4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java | [
"Apache-2.0"
] | Java | isDecimal | null | public static boolean isDecimal(String str, int beginIndex, int endIndex)
{
if ( str.charAt(str.length() - 1) == '.'
|| str.charAt(0) == '.' ) {
return false;
}
char c;
int p= 0; //number of point
for ( int j = 1; j < str.length(); j++ ) {
c = str.charAt(j);
if ( c == '.' ) {
p++;
} else {
//make full-width half-width
if ( c > 65280 ) c -= 65248;
if ( c < 48 || c > 57 ) return false;
}
}
return (p==1);
} | /**
* check the specified char is a decimal including the full-width char
*
* @param str
* @param beginIndex
* @param endIndex
* @return boolean
*/ | check the specified char is a decimal including the full-width char
| [
"check",
"the",
"specified",
"char",
"is",
"a",
"decimal",
"including",
"the",
"full",
"-",
"width",
"char"
] | public static boolean isDecimal(String str, int beginIndex, int endIndex)
{
if ( str.charAt(str.length() - 1) == '.'
|| str.charAt(0) == '.' ) {
return false;
}
char c;
int p= 0;
for ( int j = 1; j < str.length(); j++ ) {
c = str.charAt(j);
if ( c == '.' ) {
p++;
} else {
if ( c > 65280 ) c -= 65248;
if ( c < 48 || c > 57 ) return false;
}
}
return (p==1);
} | [
"public",
"static",
"boolean",
"isDecimal",
"(",
"String",
"str",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"if",
"(",
"str",
".",
"charAt",
"(",
"str",
".",
"length",
"(",
")",
"-",
"1",
")",
"==",
"'.'",
"||",
"str",
".",
"charAt",
"(",
"0",
")",
"==",
"'.'",
")",
"{",
"return",
"false",
";",
"}",
"char",
"c",
";",
"int",
"p",
"=",
"0",
";",
"for",
"(",
"int",
"j",
"=",
"1",
";",
"j",
"<",
"str",
".",
"length",
"(",
")",
";",
"j",
"++",
")",
"{",
"c",
"=",
"str",
".",
"charAt",
"(",
"j",
")",
";",
"if",
"(",
"c",
"==",
"'.'",
")",
"{",
"p",
"++",
";",
"}",
"else",
"{",
"if",
"(",
"c",
">",
"65280",
")",
"c",
"-=",
"65248",
";",
"if",
"(",
"c",
"<",
"48",
"||",
"c",
">",
"57",
")",
"return",
"false",
";",
"}",
"}",
"return",
"(",
"p",
"==",
"1",
")",
";",
"}"
] | check the specified char is a decimal including the full-width char | [
"check",
"the",
"specified",
"char",
"is",
"a",
"decimal",
"including",
"the",
"full",
"-",
"width",
"char"
] | [
"//number of point",
"//make full-width half-width"
] | [
{
"param": "str",
"type": "String"
},
{
"param": "beginIndex",
"type": "int"
},
{
"param": "endIndex",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "beginIndex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "endIndex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
353,
5749,
12,
780,
609,
16,
509,
30929,
16,
509,
13818,
13,
203,
565,
288,
203,
3639,
309,
261,
609,
18,
3001,
861,
12,
701,
18,
2469,
1435,
300,
404,
13,
422,
2611,
203,
7734,
747,
609,
18,
3001,
861,
12,
20,
13,
422,
2611,
262,
288,
203,
5411,
327,
629,
31,
203,
3639,
289,
203,
203,
3639,
1149,
276,
31,
203,
3639,
509,
293,
33,
374,
31,
3639,
368,
2696,
434,
1634,
203,
3639,
364,
261,
509,
525,
273,
404,
31,
525,
411,
609,
18,
2469,
5621,
525,
9904,
262,
288,
203,
5411,
276,
273,
609,
18,
3001,
861,
12,
78,
1769,
203,
5411,
309,
261,
276,
422,
2611,
262,
288,
203,
7734,
293,
9904,
31,
203,
5411,
289,
469,
288,
203,
7734,
368,
6540,
1983,
17,
2819,
8816,
17,
2819,
203,
7734,
309,
261,
276,
405,
1666,
9401,
3672,
262,
276,
3947,
15892,
3247,
28,
31,
203,
7734,
309,
261,
276,
411,
9934,
747,
276,
405,
15981,
262,
327,
629,
31,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
327,
261,
84,
631,
21,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
30929,
203,
377,
380,
632,
891,
282,
13818,
203,
377,
380,
632,
2463,
225,
1250,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c223ffcdb29bbeb9539b636b6363ffa9083fbae4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java | [
"Apache-2.0"
] | Java | isLatin | null | public static boolean isLatin(String str, int beginIndex, int endIndex)
{
for ( int j = beginIndex; j < endIndex; j++ ) {
if ( ! isEnChar(str.charAt(j)) ) {
return false;
}
}
return true;
} | /**
* check if the specified string is all Latin chars
*
* @param str
* @param beginIndex
* @param endIndex
* @return boolean
*/ | check if the specified string is all Latin chars
| [
"check",
"if",
"the",
"specified",
"string",
"is",
"all",
"Latin",
"chars"
] | public static boolean isLatin(String str, int beginIndex, int endIndex)
{
for ( int j = beginIndex; j < endIndex; j++ ) {
if ( ! isEnChar(str.charAt(j)) ) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isLatin",
"(",
"String",
"str",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"beginIndex",
";",
"j",
"<",
"endIndex",
";",
"j",
"++",
")",
"{",
"if",
"(",
"!",
"isEnChar",
"(",
"str",
".",
"charAt",
"(",
"j",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | check if the specified string is all Latin chars | [
"check",
"if",
"the",
"specified",
"string",
"is",
"all",
"Latin",
"chars"
] | [] | [
{
"param": "str",
"type": "String"
},
{
"param": "beginIndex",
"type": "int"
},
{
"param": "endIndex",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "beginIndex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "endIndex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
353,
6607,
267,
12,
780,
609,
16,
509,
30929,
16,
509,
13818,
13,
203,
565,
288,
203,
3639,
364,
261,
509,
525,
273,
30929,
31,
525,
411,
13818,
31,
525,
9904,
262,
288,
203,
5411,
309,
261,
401,
353,
664,
2156,
12,
701,
18,
3001,
861,
12,
78,
3719,
262,
288,
203,
7734,
327,
629,
31,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
327,
638,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
866,
309,
326,
1269,
533,
353,
777,
11134,
267,
5230,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
609,
203,
377,
380,
632,
891,
282,
30929,
203,
377,
380,
632,
891,
282,
13818,
203,
377,
380,
632,
2463,
225,
1250,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c223ffcdb29bbeb9539b636b6363ffa9083fbae4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java | [
"Apache-2.0"
] | Java | isCJK | null | public static boolean isCJK(String str, int beginIndex, int endIndex)
{
for ( int j = beginIndex; j < endIndex; j++ ) {
if ( ! isCJKChar(str.charAt(j)) ) {
return false;
}
}
return true;
} | /**
* check if the specified string is all CJK chars
*
* @param str
* @param beginIndex
* @param endIndex
* @return boolean
*/ | check if the specified string is all CJK chars
| [
"check",
"if",
"the",
"specified",
"string",
"is",
"all",
"CJK",
"chars"
] | public static boolean isCJK(String str, int beginIndex, int endIndex)
{
for ( int j = beginIndex; j < endIndex; j++ ) {
if ( ! isCJKChar(str.charAt(j)) ) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isCJK",
"(",
"String",
"str",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"beginIndex",
";",
"j",
"<",
"endIndex",
";",
"j",
"++",
")",
"{",
"if",
"(",
"!",
"isCJKChar",
"(",
"str",
".",
"charAt",
"(",
"j",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | check if the specified string is all CJK chars | [
"check",
"if",
"the",
"specified",
"string",
"is",
"all",
"CJK",
"chars"
] | [] | [
{
"param": "str",
"type": "String"
},
{
"param": "beginIndex",
"type": "int"
},
{
"param": "endIndex",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "beginIndex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "endIndex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
25249,
19474,
12,
780,
609,
16,
509,
30929,
16,
509,
13818,
13,
203,
565,
288,
203,
3639,
364,
261,
509,
525,
273,
30929,
31,
525,
411,
13818,
31,
525,
9904,
262,
288,
203,
5411,
309,
261,
401,
25249,
19474,
2156,
12,
701,
18,
3001,
861,
12,
78,
3719,
262,
288,
203,
7734,
327,
629,
31,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
327,
638,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
866,
309,
326,
1269,
533,
353,
777,
385,
19474,
5230,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
609,
203,
377,
380,
632,
891,
282,
30929,
203,
377,
380,
632,
891,
282,
13818,
203,
377,
380,
632,
2463,
225,
1250,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c223ffcdb29bbeb9539b636b6363ffa9083fbae4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java | [
"Apache-2.0"
] | Java | isLetterOrNumeric | null | public static boolean isLetterOrNumeric(String str, int beginIndex, int endIndex)
{
for ( int i = beginIndex; i < endIndex; i++ ) {
char chr = str.charAt(i);
if ( ! StringUtil.isEnLetter(chr)
&& ! StringUtil.isEnNumeric(chr) ) {
return false;
}
}
return true;
} | /**
* check if the specified string is Latin numeric or letter
*
* @param str
* @param beginIndex
* @param endIndex
* @return boolean
*/ | check if the specified string is Latin numeric or letter
| [
"check",
"if",
"the",
"specified",
"string",
"is",
"Latin",
"numeric",
"or",
"letter"
] | public static boolean isLetterOrNumeric(String str, int beginIndex, int endIndex)
{
for ( int i = beginIndex; i < endIndex; i++ ) {
char chr = str.charAt(i);
if ( ! StringUtil.isEnLetter(chr)
&& ! StringUtil.isEnNumeric(chr) ) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isLetterOrNumeric",
"(",
"String",
"str",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"beginIndex",
";",
"i",
"<",
"endIndex",
";",
"i",
"++",
")",
"{",
"char",
"chr",
"=",
"str",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"!",
"StringUtil",
".",
"isEnLetter",
"(",
"chr",
")",
"&&",
"!",
"StringUtil",
".",
"isEnNumeric",
"(",
"chr",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | check if the specified string is Latin numeric or letter | [
"check",
"if",
"the",
"specified",
"string",
"is",
"Latin",
"numeric",
"or",
"letter"
] | [] | [
{
"param": "str",
"type": "String"
},
{
"param": "beginIndex",
"type": "int"
},
{
"param": "endIndex",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "beginIndex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "endIndex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
353,
13938,
1162,
9902,
12,
780,
609,
16,
509,
30929,
16,
509,
13818,
13,
203,
565,
288,
203,
3639,
364,
261,
509,
277,
273,
30929,
31,
277,
411,
13818,
31,
277,
9904,
262,
288,
203,
5411,
1149,
4513,
273,
609,
18,
3001,
861,
12,
77,
1769,
203,
5411,
309,
261,
401,
14205,
18,
291,
664,
13938,
12,
15182,
13,
203,
10792,
597,
401,
14205,
18,
291,
664,
9902,
12,
15182,
13,
262,
288,
203,
7734,
327,
629,
31,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
327,
638,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
866,
309,
326,
1269,
533,
353,
11134,
267,
6389,
578,
9471,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
609,
203,
377,
380,
632,
891,
282,
30929,
203,
377,
380,
632,
891,
282,
13818,
203,
377,
380,
632,
2463,
225,
1250,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c223ffcdb29bbeb9539b636b6363ffa9083fbae4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java | [
"Apache-2.0"
] | Java | isLetter | null | public static boolean isLetter(String str, int beginIndex, int endIndex)
{
for ( int i = beginIndex; i < endIndex; i++ ) {
char chr = str.charAt(i);
if ( ! StringUtil.isEnLetter(chr) ) {
return false;
}
}
return true;
} | /**
* check if the specified string is Latin letter
*
* @param str
* @param beginIndex
* @param endIndex
* @return boolean
*/ | check if the specified string is Latin letter
| [
"check",
"if",
"the",
"specified",
"string",
"is",
"Latin",
"letter"
] | public static boolean isLetter(String str, int beginIndex, int endIndex)
{
for ( int i = beginIndex; i < endIndex; i++ ) {
char chr = str.charAt(i);
if ( ! StringUtil.isEnLetter(chr) ) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isLetter",
"(",
"String",
"str",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"beginIndex",
";",
"i",
"<",
"endIndex",
";",
"i",
"++",
")",
"{",
"char",
"chr",
"=",
"str",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"!",
"StringUtil",
".",
"isEnLetter",
"(",
"chr",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | check if the specified string is Latin letter | [
"check",
"if",
"the",
"specified",
"string",
"is",
"Latin",
"letter"
] | [] | [
{
"param": "str",
"type": "String"
},
{
"param": "beginIndex",
"type": "int"
},
{
"param": "endIndex",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "beginIndex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "endIndex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
353,
13938,
12,
780,
609,
16,
509,
30929,
16,
509,
13818,
13,
203,
565,
288,
203,
3639,
364,
261,
509,
277,
273,
30929,
31,
277,
411,
13818,
31,
277,
9904,
262,
288,
203,
5411,
1149,
4513,
273,
609,
18,
3001,
861,
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
2463,
225,
1250,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c223ffcdb29bbeb9539b636b6363ffa9083fbae4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java | [
"Apache-2.0"
] | Java | isNumeric | null | public static boolean isNumeric(String str, int beginIndex, int endIndex)
{
for ( int i = beginIndex; i < endIndex; i++ ) {
char chr = str.charAt(i);
if ( ! StringUtil.isEnNumeric(chr) ) {
return false;
}
}
return true;
} | /**
* check if the specified string is Latin numeric
*
* @param str
* @param beginIndex
* @param endIndex
* @return boolean
*/ | check if the specified string is Latin numeric
| [
"check",
"if",
"the",
"specified",
"string",
"is",
"Latin",
"numeric"
] | public static boolean isNumeric(String str, int beginIndex, int endIndex)
{
for ( int i = beginIndex; i < endIndex; i++ ) {
char chr = str.charAt(i);
if ( ! StringUtil.isEnNumeric(chr) ) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isNumeric",
"(",
"String",
"str",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"beginIndex",
";",
"i",
"<",
"endIndex",
";",
"i",
"++",
")",
"{",
"char",
"chr",
"=",
"str",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"!",
"StringUtil",
".",
"isEnNumeric",
"(",
"chr",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | check if the specified string is Latin numeric | [
"check",
"if",
"the",
"specified",
"string",
"is",
"Latin",
"numeric"
] | [] | [
{
"param": "str",
"type": "String"
},
{
"param": "beginIndex",
"type": "int"
},
{
"param": "endIndex",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "beginIndex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "endIndex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
26434,
12,
780,
609,
16,
509,
30929,
16,
509,
13818,
13,
203,
565,
288,
203,
3639,
364,
261,
509,
277,
273,
30929,
31,
277,
411,
13818,
31,
277,
9904,
262,
288,
203,
5411,
1149,
4513,
273,
609,
18,
3001,
861,
12,
77,
1769,
203,
5411,
309,
261,
401,
14205,
18,
291,
664,
9902,
12,
15182,
13,
262,
288,
203,
7734,
327,
629,
31,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
327,
638,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
866,
309,
326,
1269,
533,
353,
11134,
267,
6389,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
609,
203,
377,
380,
632,
891,
282,
30929,
203,
377,
380,
632,
891,
282,
13818,
203,
377,
380,
632,
2463,
225,
1250,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c223ffcdb29bbeb9539b636b6363ffa9083fbae4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java | [
"Apache-2.0"
] | Java | latinIndexOf | null | public static int latinIndexOf(String str, int offset)
{
for ( int j = offset; j < str.length(); j++ ) {
if ( isEnChar(str.charAt(j)) ) {
return j;
}
}
return -1;
} | /**
* get the index of the first Latin char of the specified string
*
* @param str
* @param offset
* @return integer
*/ | get the index of the first Latin char of the specified string
@param str
@param offset
@return integer | [
"get",
"the",
"index",
"of",
"the",
"first",
"Latin",
"char",
"of",
"the",
"specified",
"string",
"@param",
"str",
"@param",
"offset",
"@return",
"integer"
] | public static int latinIndexOf(String str, int offset)
{
for ( int j = offset; j < str.length(); j++ ) {
if ( isEnChar(str.charAt(j)) ) {
return j;
}
}
return -1;
} | [
"public",
"static",
"int",
"latinIndexOf",
"(",
"String",
"str",
",",
"int",
"offset",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"offset",
";",
"j",
"<",
"str",
".",
"length",
"(",
")",
";",
"j",
"++",
")",
"{",
"if",
"(",
"isEnChar",
"(",
"str",
".",
"charAt",
"(",
"j",
")",
")",
")",
"{",
"return",
"j",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] | get the index of the first Latin char of the specified string | [
"get",
"the",
"index",
"of",
"the",
"first",
"Latin",
"char",
"of",
"the",
"specified",
"string"
] | [] | [
{
"param": "str",
"type": "String"
},
{
"param": "offset",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
509,
30486,
31985,
12,
780,
609,
16,
509,
1384,
13,
203,
565,
288,
203,
3639,
364,
261,
509,
525,
273,
1384,
31,
525,
411,
609,
18,
2469,
5621,
525,
9904,
262,
288,
203,
5411,
309,
261,
353,
664,
2156,
12,
701,
18,
3001,
861,
12,
78,
3719,
262,
288,
203,
7734,
327,
525,
31,
203,
5411,
289,
203,
3639,
289,
203,
540,
203,
3639,
327,
300,
21,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
336,
326,
770,
434,
326,
1122,
11134,
267,
1149,
434,
326,
1269,
533,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
609,
203,
377,
380,
632,
891,
282,
1384,
203,
377,
380,
632,
2463,
225,
3571,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c223ffcdb29bbeb9539b636b6363ffa9083fbae4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java | [
"Apache-2.0"
] | Java | CJKIndexOf | null | public static int CJKIndexOf(String str, int offset)
{
for ( int j = offset; j < str.length(); j++ ) {
if ( isCJKChar(str.charAt(j)) ) {
return j;
}
}
return -1;
} | /**
* get the index of the first CJK char of the specified string
*
* @param str
* @param offset
* @return integer
*/ | get the index of the first CJK char of the specified string
@param str
@param offset
@return integer | [
"get",
"the",
"index",
"of",
"the",
"first",
"CJK",
"char",
"of",
"the",
"specified",
"string",
"@param",
"str",
"@param",
"offset",
"@return",
"integer"
] | public static int CJKIndexOf(String str, int offset)
{
for ( int j = offset; j < str.length(); j++ ) {
if ( isCJKChar(str.charAt(j)) ) {
return j;
}
}
return -1;
} | [
"public",
"static",
"int",
"CJKIndexOf",
"(",
"String",
"str",
",",
"int",
"offset",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"offset",
";",
"j",
"<",
"str",
".",
"length",
"(",
")",
";",
"j",
"++",
")",
"{",
"if",
"(",
"isCJKChar",
"(",
"str",
".",
"charAt",
"(",
"j",
")",
")",
")",
"{",
"return",
"j",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] | get the index of the first CJK char of the specified string | [
"get",
"the",
"index",
"of",
"the",
"first",
"CJK",
"char",
"of",
"the",
"specified",
"string"
] | [] | [
{
"param": "str",
"type": "String"
},
{
"param": "offset",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
509,
385,
19474,
31985,
12,
780,
609,
16,
509,
1384,
13,
203,
565,
288,
203,
3639,
364,
261,
509,
525,
273,
1384,
31,
525,
411,
609,
18,
2469,
5621,
525,
9904,
262,
288,
203,
5411,
309,
261,
25249,
19474,
2156,
12,
701,
18,
3001,
861,
12,
78,
3719,
262,
288,
203,
7734,
327,
525,
31,
203,
5411,
289,
203,
3639,
289,
203,
540,
203,
3639,
327,
300,
21,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
336,
326,
770,
434,
326,
1122,
385,
19474,
1149,
434,
326,
1269,
533,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
609,
203,
377,
380,
632,
891,
282,
1384,
203,
377,
380,
632,
2463,
225,
3571,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c223ffcdb29bbeb9539b636b6363ffa9083fbae4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java | [
"Apache-2.0"
] | Java | fwsTohws | String | public static String fwsTohws( String str )
{
char[] chars = str.toCharArray();
for ( int j = 0; j < chars.length; j++ ) {
if ( chars[j] == '\u3000' ) {
chars[j] = '\u0020';
} else if ( chars[j] > '\uFF00'
&& chars[j] < '\uFF5F' ) {
chars[j] = (char)(chars[j] - 65248);
}
}
return new String(chars);
} | /**
* a static method to replace the full-width char to the half-width char in a given string
* (65281-65374 for full-width char)
*
* @param str
* @return String the new String after the replace.
*/ | a static method to replace the full-width char to the half-width char in a given string
(65281-65374 for full-width char)
@param str
@return String the new String after the replace. | [
"a",
"static",
"method",
"to",
"replace",
"the",
"full",
"-",
"width",
"char",
"to",
"the",
"half",
"-",
"width",
"char",
"in",
"a",
"given",
"string",
"(",
"65281",
"-",
"65374",
"for",
"full",
"-",
"width",
"char",
")",
"@param",
"str",
"@return",
"String",
"the",
"new",
"String",
"after",
"the",
"replace",
"."
] | public static String fwsTohws( String str )
{
char[] chars = str.toCharArray();
for ( int j = 0; j < chars.length; j++ ) {
if ( chars[j] == '\u3000' ) {
chars[j] = '\u0020';
} else if ( chars[j] > '\uFF00'
&& chars[j] < '\uFF5F' ) {
chars[j] = (char)(chars[j] - 65248);
}
}
return new String(chars);
} | [
"public",
"static",
"String",
"fwsTohws",
"(",
"String",
"str",
")",
"{",
"char",
"[",
"]",
"chars",
"=",
"str",
".",
"toCharArray",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"chars",
".",
"length",
";",
"j",
"++",
")",
"{",
"if",
"(",
"chars",
"[",
"j",
"]",
"==",
"'\\u3000'",
")",
"{",
"chars",
"[",
"j",
"]",
"=",
"'\\u0020'",
";",
"}",
"else",
"if",
"(",
"chars",
"[",
"j",
"]",
">",
"'\\uFF00'",
"&&",
"chars",
"[",
"j",
"]",
"<",
"'\\uFF5F'",
")",
"{",
"chars",
"[",
"j",
"]",
"=",
"(",
"char",
")",
"(",
"chars",
"[",
"j",
"]",
"-",
"65248",
")",
";",
"}",
"}",
"return",
"new",
"String",
"(",
"chars",
")",
";",
"}"
] | a static method to replace the full-width char to the half-width char in a given string
(65281-65374 for full-width char) | [
"a",
"static",
"method",
"to",
"replace",
"the",
"full",
"-",
"width",
"char",
"to",
"the",
"half",
"-",
"width",
"char",
"in",
"a",
"given",
"string",
"(",
"65281",
"-",
"65374",
"for",
"full",
"-",
"width",
"char",
")"
] | [] | [
{
"param": "str",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
514,
284,
4749,
774,
76,
4749,
12,
514,
609,
262,
203,
565,
288,
203,
3639,
1149,
8526,
5230,
273,
609,
18,
869,
15936,
5621,
203,
3639,
364,
261,
509,
525,
273,
374,
31,
525,
411,
5230,
18,
2469,
31,
525,
9904,
262,
288,
203,
5411,
309,
261,
5230,
63,
78,
65,
422,
2337,
89,
23,
3784,
11,
262,
288,
203,
7734,
5230,
63,
78,
65,
273,
2337,
89,
713,
3462,
13506,
203,
5411,
289,
469,
309,
261,
5230,
63,
78,
65,
405,
2337,
89,
2246,
713,
11,
7010,
7734,
597,
5230,
63,
78,
65,
411,
2337,
89,
2246,
25,
42,
11,
262,
288,
203,
7734,
5230,
63,
78,
65,
273,
261,
3001,
21433,
7549,
63,
78,
65,
300,
15892,
3247,
28,
1769,
203,
5411,
289,
3639,
203,
3639,
289,
203,
540,
203,
3639,
327,
394,
514,
12,
7549,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
279,
760,
707,
358,
1453,
326,
1983,
17,
2819,
1149,
358,
326,
8816,
17,
2819,
1149,
316,
279,
864,
533,
203,
377,
380,
261,
9222,
6030,
21,
17,
26,
8643,
5608,
364,
1983,
17,
2819,
1149,
13,
203,
377,
380,
7010,
377,
380,
632,
891,
609,
203,
377,
380,
632,
2463,
514,
326,
394,
514,
1839,
326,
1453,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c223ffcdb29bbeb9539b636b6363ffa9083fbae4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java | [
"Apache-2.0"
] | Java | hwsTofws | String | public static String hwsTofws( String str )
{
char[] chars = str.toCharArray();
for ( int j = 0; j < chars.length; j++ ) {
if ( chars[j] == '\u0020' ) {
chars[j] = '\u3000';
} else if ( chars[j] < '\177' ) {
chars[j] = (char)(chars[j] + 65248);
}
}
return new String(chars);
} | /**
* a static method to replace the half-width char to the full-width char in a given string
*
* @param str
* @return String the new String after the replace
*/ | a static method to replace the half-width char to the full-width char in a given string
@param str
@return String the new String after the replace | [
"a",
"static",
"method",
"to",
"replace",
"the",
"half",
"-",
"width",
"char",
"to",
"the",
"full",
"-",
"width",
"char",
"in",
"a",
"given",
"string",
"@param",
"str",
"@return",
"String",
"the",
"new",
"String",
"after",
"the",
"replace"
] | public static String hwsTofws( String str )
{
char[] chars = str.toCharArray();
for ( int j = 0; j < chars.length; j++ ) {
if ( chars[j] == '\u0020' ) {
chars[j] = '\u3000';
} else if ( chars[j] < '\177' ) {
chars[j] = (char)(chars[j] + 65248);
}
}
return new String(chars);
} | [
"public",
"static",
"String",
"hwsTofws",
"(",
"String",
"str",
")",
"{",
"char",
"[",
"]",
"chars",
"=",
"str",
".",
"toCharArray",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"chars",
".",
"length",
";",
"j",
"++",
")",
"{",
"if",
"(",
"chars",
"[",
"j",
"]",
"==",
"'\\u0020'",
")",
"{",
"chars",
"[",
"j",
"]",
"=",
"'\\u3000'",
";",
"}",
"else",
"if",
"(",
"chars",
"[",
"j",
"]",
"<",
"'\\177'",
")",
"{",
"chars",
"[",
"j",
"]",
"=",
"(",
"char",
")",
"(",
"chars",
"[",
"j",
"]",
"+",
"65248",
")",
";",
"}",
"}",
"return",
"new",
"String",
"(",
"chars",
")",
";",
"}"
] | a static method to replace the half-width char to the full-width char in a given string | [
"a",
"static",
"method",
"to",
"replace",
"the",
"half",
"-",
"width",
"char",
"to",
"the",
"full",
"-",
"width",
"char",
"in",
"a",
"given",
"string"
] | [] | [
{
"param": "str",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
514,
366,
4749,
774,
74,
4749,
12,
514,
609,
262,
203,
565,
288,
203,
3639,
1149,
8526,
5230,
273,
609,
18,
869,
15936,
5621,
203,
3639,
364,
261,
509,
525,
273,
374,
31,
525,
411,
5230,
18,
2469,
31,
525,
9904,
262,
288,
203,
5411,
309,
261,
5230,
63,
78,
65,
422,
2337,
89,
713,
3462,
11,
262,
288,
203,
7734,
5230,
63,
78,
65,
273,
2337,
89,
23,
3784,
13506,
203,
5411,
289,
469,
309,
261,
5230,
63,
78,
65,
411,
2337,
29882,
11,
262,
288,
203,
7734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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
279,
760,
707,
358,
1453,
326,
8816,
17,
2819,
1149,
358,
326,
1983,
17,
2819,
1149,
316,
279,
864,
533,
203,
377,
380,
7010,
377,
380,
632,
891,
609,
203,
377,
380,
632,
2463,
514,
326,
394,
514,
1839,
326,
1453,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c223ffcdb29bbeb9539b636b6363ffa9083fbae4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java | [
"Apache-2.0"
] | Java | isPunctuation | null | public static boolean isPunctuation(String str, int beginIndex, int endIndex)
{
for ( int i = beginIndex; i < endIndex; i++ ) {
char chr = str.charAt(i);
if ( ! StringUtil.isEnPunctuation(chr)
|| ! StringUtil.isCnPunctuation(chr) ) {
return false;
}
}
return true;
} | /**
* Check if the specified string is all punctuation chars (English and Chinese punctuation)
* @param str
* @param beginIndex
* @param endIndex
* @return boolean
*/ | Check if the specified string is all punctuation chars (English and Chinese punctuation)
@param str
@param beginIndex
@param endIndex
@return boolean | [
"Check",
"if",
"the",
"specified",
"string",
"is",
"all",
"punctuation",
"chars",
"(",
"English",
"and",
"Chinese",
"punctuation",
")",
"@param",
"str",
"@param",
"beginIndex",
"@param",
"endIndex",
"@return",
"boolean"
] | public static boolean isPunctuation(String str, int beginIndex, int endIndex)
{
for ( int i = beginIndex; i < endIndex; i++ ) {
char chr = str.charAt(i);
if ( ! StringUtil.isEnPunctuation(chr)
|| ! StringUtil.isCnPunctuation(chr) ) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isPunctuation",
"(",
"String",
"str",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"beginIndex",
";",
"i",
"<",
"endIndex",
";",
"i",
"++",
")",
"{",
"char",
"chr",
"=",
"str",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"!",
"StringUtil",
".",
"isEnPunctuation",
"(",
"chr",
")",
"||",
"!",
"StringUtil",
".",
"isCnPunctuation",
"(",
"chr",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Check if the specified string is all punctuation chars (English and Chinese punctuation)
@param str
@param beginIndex
@param endIndex
@return boolean | [
"Check",
"if",
"the",
"specified",
"string",
"is",
"all",
"punctuation",
"chars",
"(",
"English",
"and",
"Chinese",
"punctuation",
")",
"@param",
"str",
"@param",
"beginIndex",
"@param",
"endIndex",
"@return",
"boolean"
] | [] | [
{
"param": "str",
"type": "String"
},
{
"param": "beginIndex",
"type": "int"
},
{
"param": "endIndex",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "beginIndex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "endIndex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
29962,
15726,
12,
780,
609,
16,
509,
30929,
16,
509,
13818,
13,
203,
565,
288,
203,
377,
202,
1884,
261,
509,
277,
273,
30929,
31,
277,
411,
13818,
31,
277,
9904,
262,
288,
203,
377,
202,
202,
3001,
4513,
273,
609,
18,
3001,
861,
12,
77,
1769,
203,
377,
202,
202,
430,
261,
401,
14205,
18,
291,
664,
52,
15726,
12,
15182,
13,
7010,
377,
9506,
202,
20081,
401,
14205,
18,
291,
21111,
52,
15726,
12,
15182,
13,
262,
288,
203,
377,
1082,
202,
2463,
629,
31,
203,
377,
202,
202,
97,
203,
377,
202,
97,
203,
203,
377,
202,
2463,
638,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2073,
309,
326,
1269,
533,
353,
777,
22472,
5230,
261,
664,
13740,
471,
1680,
25331,
22472,
13,
203,
377,
380,
632,
891,
282,
609,
203,
377,
380,
632,
891,
282,
30929,
203,
377,
380,
632,
891,
282,
13818,
203,
377,
380,
632,
2463,
225,
1250,
203,
282,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7f6c04d9ba7a6afd277eb68bb770449af89d1824 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/SynonymsEntry.java | [
"Apache-2.0"
] | Java | add | null | public void add(IWord word)
{
//check and extends the entity from the base word
if ( word.getEntity() == null ) {
word.setEntity(rootWord.getEntity());
}
//check and extends the part of speech from the base word
if ( word.getPartSpeech() == null ) {
word.setPartSpeech(rootWord.getPartSpeech());
}
word.setSyn(this);
synsList.add(word);
} | /**
* add a new synonyms word
* and the newly added word will extends the part of speech and the entity
* from the base word if there are not set
*
* @param word
*/ | add a new synonyms word
and the newly added word will extends the part of speech and the entity
from the base word if there are not set
@param word | [
"add",
"a",
"new",
"synonyms",
"word",
"and",
"the",
"newly",
"added",
"word",
"will",
"extends",
"the",
"part",
"of",
"speech",
"and",
"the",
"entity",
"from",
"the",
"base",
"word",
"if",
"there",
"are",
"not",
"set",
"@param",
"word"
] | public void add(IWord word)
{
if ( word.getEntity() == null ) {
word.setEntity(rootWord.getEntity());
}
if ( word.getPartSpeech() == null ) {
word.setPartSpeech(rootWord.getPartSpeech());
}
word.setSyn(this);
synsList.add(word);
} | [
"public",
"void",
"add",
"(",
"IWord",
"word",
")",
"{",
"if",
"(",
"word",
".",
"getEntity",
"(",
")",
"==",
"null",
")",
"{",
"word",
".",
"setEntity",
"(",
"rootWord",
".",
"getEntity",
"(",
")",
")",
";",
"}",
"if",
"(",
"word",
".",
"getPartSpeech",
"(",
")",
"==",
"null",
")",
"{",
"word",
".",
"setPartSpeech",
"(",
"rootWord",
".",
"getPartSpeech",
"(",
")",
")",
";",
"}",
"word",
".",
"setSyn",
"(",
"this",
")",
";",
"synsList",
".",
"add",
"(",
"word",
")",
";",
"}"
] | add a new synonyms word
and the newly added word will extends the part of speech and the entity
from the base word if there are not set | [
"add",
"a",
"new",
"synonyms",
"word",
"and",
"the",
"newly",
"added",
"word",
"will",
"extends",
"the",
"part",
"of",
"speech",
"and",
"the",
"entity",
"from",
"the",
"base",
"word",
"if",
"there",
"are",
"not",
"set"
] | [
"//check and extends the entity from the base word",
"//check and extends the part of speech from the base word"
] | [
{
"param": "word",
"type": "IWord"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "word",
"type": "IWord",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
527,
12,
45,
3944,
2076,
13,
203,
565,
288,
203,
3639,
368,
1893,
471,
3231,
326,
1522,
628,
326,
1026,
2076,
203,
3639,
309,
261,
2076,
18,
588,
1943,
1435,
422,
446,
262,
288,
203,
5411,
2076,
18,
542,
1943,
12,
3085,
3944,
18,
588,
1943,
10663,
203,
3639,
289,
203,
540,
203,
3639,
368,
1893,
471,
3231,
326,
1087,
434,
24556,
628,
326,
1026,
2076,
203,
3639,
309,
261,
2076,
18,
588,
1988,
22334,
1435,
422,
446,
262,
288,
203,
5411,
2076,
18,
542,
1988,
22334,
12,
3085,
3944,
18,
588,
1988,
22334,
10663,
203,
3639,
289,
203,
540,
203,
3639,
2076,
18,
542,
10503,
12,
2211,
1769,
203,
3639,
6194,
21576,
18,
1289,
12,
1095,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
527,
279,
394,
27260,
2076,
203,
377,
380,
471,
326,
10894,
3096,
2076,
903,
3231,
326,
1087,
434,
24556,
471,
326,
1522,
7010,
377,
380,
225,
628,
326,
1026,
2076,
309,
1915,
854,
486,
444,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
2076,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
4011bb883274c059b253b6025963a07b5b45a60c | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/segmenter/MostSeg.java | [
"Apache-2.0"
] | Java | enWordSeg | null | @Override
protected LinkedList<IWord> enWordSeg(IWord w, LinkedList<IWord> wList)
{
int curidx = 0, pos = w.getPosition(), len = w.getValue().length();
IWord tw = null;
String str = null;
int ignidx = 0, mnum = 0;
boolean ignore = false;
/* for search module we track the whole original token as one of the result */
wList.add(w);
final IStringBuffer sb = new IStringBuffer(config.EN_MAX_LEN);
final char[] chars = w.getValue().toCharArray();
while ( curidx < chars.length ) {
/* check and append the single letter word */
str = String.valueOf(chars[curidx]);
ignore = (curidx == 0 && str.length() == len);
if ( ignore == false && dic.match(ILexicon.CJK_WORD, str) ) {
tw = dic.get(ILexicon.CJK_WORD, str).clone();
tw.setPosition(pos+curidx);
wList.add(tw);
}
sb.clear().append(chars[curidx]);
for ( int j = 1; j < config.EN_MAX_LEN && (curidx+j) < chars.length; j++ ) {
sb.append(chars[curidx+j]);
str = sb.toString();
/* check and ignore the source w itself */
if ( curidx == 0 && str.length() == len ) {
continue;
}
if ( dic.match(ILexicon.CJK_WORD, str) ) {
mnum = 1;
ignidx = Math.max(ignidx, curidx + j);
tw = dic.get(ILexicon.CJK_WORD, str).clone();
tw.setPosition(pos+curidx);
wList.add(tw);
}
}
/*
* no matches here:
* should the current character chars[cjkidx] be a single word ?
* lets do the current check
*/
if ( ignore == false && mnum == 0 && (curidx == 0 || curidx > ignidx) ) {
String temp = String.valueOf(chars[curidx]);
if ( ! dic.match(ILexicon.CJK_WORD, temp) ) {
tw = new Word(temp, ILexicon.UNMATCH_CJK_WORD);
tw.setPartSpeech(IWord.UNRECOGNIZE);
tw.setPosition(pos+curidx);
wList.add(tw);
}
}
curidx++;
}
sb.clear();
return wList;
} | /**
* Latin word lexicon based English word segmentation for search mode
*
* @param w
* @param wList
* @return LinkedList<IWord> all the sub word tokens
*/ | Latin word lexicon based English word segmentation for search mode
@param w
@param wList
@return LinkedList all the sub word tokens | [
"Latin",
"word",
"lexicon",
"based",
"English",
"word",
"segmentation",
"for",
"search",
"mode",
"@param",
"w",
"@param",
"wList",
"@return",
"LinkedList",
"all",
"the",
"sub",
"word",
"tokens"
] | @Override
protected LinkedList<IWord> enWordSeg(IWord w, LinkedList<IWord> wList)
{
int curidx = 0, pos = w.getPosition(), len = w.getValue().length();
IWord tw = null;
String str = null;
int ignidx = 0, mnum = 0;
boolean ignore = false;
/* for search module we track the whole original token as one of the result */
wList.add(w);
final IStringBuffer sb = new IStringBuffer(config.EN_MAX_LEN);
final char[] chars = w.getValue().toCharArray();
while ( curidx < chars.length ) {
/* check and append the single letter word */
str = String.valueOf(chars[curidx]);
ignore = (curidx == 0 && str.length() == len);
if ( ignore == false && dic.match(ILexicon.CJK_WORD, str) ) {
tw = dic.get(ILexicon.CJK_WORD, str).clone();
tw.setPosition(pos+curidx);
wList.add(tw);
}
sb.clear().append(chars[curidx]);
for ( int j = 1; j < config.EN_MAX_LEN && (curidx+j) < chars.length; j++ ) {
sb.append(chars[curidx+j]);
str = sb.toString();
/* check and ignore the source w itself */
if ( curidx == 0 && str.length() == len ) {
continue;
}
if ( dic.match(ILexicon.CJK_WORD, str) ) {
mnum = 1;
ignidx = Math.max(ignidx, curidx + j);
tw = dic.get(ILexicon.CJK_WORD, str).clone();
tw.setPosition(pos+curidx);
wList.add(tw);
}
}
/*
* no matches here:
* should the current character chars[cjkidx] be a single word ?
* lets do the current check
*/
if ( ignore == false && mnum == 0 && (curidx == 0 || curidx > ignidx) ) {
String temp = String.valueOf(chars[curidx]);
if ( ! dic.match(ILexicon.CJK_WORD, temp) ) {
tw = new Word(temp, ILexicon.UNMATCH_CJK_WORD);
tw.setPartSpeech(IWord.UNRECOGNIZE);
tw.setPosition(pos+curidx);
wList.add(tw);
}
}
curidx++;
}
sb.clear();
return wList;
} | [
"@",
"Override",
"protected",
"LinkedList",
"<",
"IWord",
">",
"enWordSeg",
"(",
"IWord",
"w",
",",
"LinkedList",
"<",
"IWord",
">",
"wList",
")",
"{",
"int",
"curidx",
"=",
"0",
",",
"pos",
"=",
"w",
".",
"getPosition",
"(",
")",
",",
"len",
"=",
"w",
".",
"getValue",
"(",
")",
".",
"length",
"(",
")",
";",
"IWord",
"tw",
"=",
"null",
";",
"String",
"str",
"=",
"null",
";",
"int",
"ignidx",
"=",
"0",
",",
"mnum",
"=",
"0",
";",
"boolean",
"ignore",
"=",
"false",
";",
"/* for search module we track the whole original token as one of the result */",
"wList",
".",
"add",
"(",
"w",
")",
";",
"final",
"IStringBuffer",
"sb",
"=",
"new",
"IStringBuffer",
"(",
"config",
".",
"EN_MAX_LEN",
")",
";",
"final",
"char",
"[",
"]",
"chars",
"=",
"w",
".",
"getValue",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"while",
"(",
"curidx",
"<",
"chars",
".",
"length",
")",
"{",
"/* check and append the single letter word */",
"str",
"=",
"String",
".",
"valueOf",
"(",
"chars",
"[",
"curidx",
"]",
")",
";",
"ignore",
"=",
"(",
"curidx",
"==",
"0",
"&&",
"str",
".",
"length",
"(",
")",
"==",
"len",
")",
";",
"if",
"(",
"ignore",
"==",
"false",
"&&",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CJK_WORD",
",",
"str",
")",
")",
"{",
"tw",
"=",
"dic",
".",
"get",
"(",
"ILexicon",
".",
"CJK_WORD",
",",
"str",
")",
".",
"clone",
"(",
")",
";",
"tw",
".",
"setPosition",
"(",
"pos",
"+",
"curidx",
")",
";",
"wList",
".",
"add",
"(",
"tw",
")",
";",
"}",
"sb",
".",
"clear",
"(",
")",
".",
"append",
"(",
"chars",
"[",
"curidx",
"]",
")",
";",
"for",
"(",
"int",
"j",
"=",
"1",
";",
"j",
"<",
"config",
".",
"EN_MAX_LEN",
"&&",
"(",
"curidx",
"+",
"j",
")",
"<",
"chars",
".",
"length",
";",
"j",
"++",
")",
"{",
"sb",
".",
"append",
"(",
"chars",
"[",
"curidx",
"+",
"j",
"]",
")",
";",
"str",
"=",
"sb",
".",
"toString",
"(",
")",
";",
"/* check and ignore the source w itself */",
"if",
"(",
"curidx",
"==",
"0",
"&&",
"str",
".",
"length",
"(",
")",
"==",
"len",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CJK_WORD",
",",
"str",
")",
")",
"{",
"mnum",
"=",
"1",
";",
"ignidx",
"=",
"Math",
".",
"max",
"(",
"ignidx",
",",
"curidx",
"+",
"j",
")",
";",
"tw",
"=",
"dic",
".",
"get",
"(",
"ILexicon",
".",
"CJK_WORD",
",",
"str",
")",
".",
"clone",
"(",
")",
";",
"tw",
".",
"setPosition",
"(",
"pos",
"+",
"curidx",
")",
";",
"wList",
".",
"add",
"(",
"tw",
")",
";",
"}",
"}",
"/*\n * no matches here:\n * should the current character chars[cjkidx] be a single word ?\n * lets do the current check \n */",
"if",
"(",
"ignore",
"==",
"false",
"&&",
"mnum",
"==",
"0",
"&&",
"(",
"curidx",
"==",
"0",
"||",
"curidx",
">",
"ignidx",
")",
")",
"{",
"String",
"temp",
"=",
"String",
".",
"valueOf",
"(",
"chars",
"[",
"curidx",
"]",
")",
";",
"if",
"(",
"!",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CJK_WORD",
",",
"temp",
")",
")",
"{",
"tw",
"=",
"new",
"Word",
"(",
"temp",
",",
"ILexicon",
".",
"UNMATCH_CJK_WORD",
")",
";",
"tw",
".",
"setPartSpeech",
"(",
"IWord",
".",
"UNRECOGNIZE",
")",
";",
"tw",
".",
"setPosition",
"(",
"pos",
"+",
"curidx",
")",
";",
"wList",
".",
"add",
"(",
"tw",
")",
";",
"}",
"}",
"curidx",
"++",
";",
"}",
"sb",
".",
"clear",
"(",
")",
";",
"return",
"wList",
";",
"}"
] | Latin word lexicon based English word segmentation for search mode | [
"Latin",
"word",
"lexicon",
"based",
"English",
"word",
"segmentation",
"for",
"search",
"mode"
] | [] | [
{
"param": "w",
"type": "IWord"
},
{
"param": "wList",
"type": "LinkedList<IWord>"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "w",
"type": "IWord",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wList",
"type": "LinkedList<IWord>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
4750,
10688,
32,
45,
3944,
34,
570,
3944,
3289,
12,
45,
3944,
341,
16,
10688,
32,
45,
3944,
34,
341,
682,
13,
203,
565,
288,
203,
377,
202,
474,
662,
3465,
273,
374,
16,
949,
273,
341,
18,
588,
2555,
9334,
562,
273,
341,
18,
24805,
7675,
2469,
5621,
203,
377,
202,
45,
3944,
2339,
273,
446,
31,
203,
377,
202,
780,
609,
273,
446,
31,
203,
377,
202,
474,
9750,
3465,
273,
374,
16,
312,
2107,
273,
374,
31,
203,
377,
202,
6494,
2305,
273,
629,
31,
203,
203,
377,
202,
20308,
364,
1623,
1605,
732,
3298,
326,
7339,
2282,
1147,
487,
1245,
434,
326,
563,
1195,
203,
377,
202,
91,
682,
18,
1289,
12,
91,
1769,
203,
377,
202,
203,
377,
202,
6385,
467,
780,
1892,
2393,
273,
394,
467,
780,
1892,
12,
1425,
18,
1157,
67,
6694,
67,
13017,
1769,
203,
377,
202,
6385,
1149,
8526,
5230,
273,
341,
18,
24805,
7675,
869,
15936,
5621,
203,
377,
202,
17523,
261,
662,
3465,
411,
5230,
18,
2469,
262,
288,
203,
377,
202,
202,
20308,
866,
471,
714,
326,
2202,
9471,
2076,
1195,
203,
1082,
202,
701,
273,
514,
18,
1132,
951,
12,
7549,
63,
1397,
3465,
19226,
203,
1082,
202,
6185,
273,
261,
1397,
3465,
422,
374,
597,
609,
18,
2469,
1435,
422,
562,
1769,
203,
1082,
202,
430,
261,
2305,
422,
629,
597,
11681,
18,
1916,
12,
2627,
338,
3950,
18,
39,
19474,
67,
7952,
16,
609,
13,
262,
288,
203,
9506,
202,
11246,
273,
11681,
18,
588,
12,
2627,
338,
3950,
18,
39,
19474,
67,
7952,
16,
609,
2934,
14056,
5621,
203,
9506,
202,
11246,
18,
542,
2555,
12,
917,
15,
1397,
3465,
1769,
203,
7734,
341,
682,
18,
1289,
12,
11246,
1769,
203,
1082,
202,
97,
203,
377,
1082,
203,
377,
202,
202,
18366,
18,
8507,
7675,
6923,
12,
7549,
63,
1397,
3465,
19226,
203,
377,
202,
202,
1884,
261,
509,
525,
273,
404,
31,
525,
411,
642,
18,
1157,
67,
6694,
67,
13017,
597,
261,
1397,
3465,
15,
78,
13,
411,
5230,
18,
2469,
31,
525,
9904,
262,
288,
203,
377,
1082,
202,
18366,
18,
6923,
12,
7549,
63,
1397,
3465,
15,
78,
19226,
203,
377,
1082,
202,
701,
273,
2393,
18,
10492,
5621,
203,
377,
9506,
203,
377,
1082,
202,
20308,
866,
471,
2305,
326,
1084,
341,
6174,
1195,
203,
377,
1082,
202,
430,
261,
662,
3465,
422,
374,
597,
609,
18,
2469,
1435,
422,
562,
262,
288,
203,
377,
9506,
202,
17143,
31,
203,
377,
1082,
202,
97,
203,
377,
9506,
203,
377,
1082,
202,
430,
261,
11681,
18,
1916,
12,
2627,
338,
3950,
18,
39,
19474,
67,
7952,
16,
609,
13,
262,
288,
203,
377,
9506,
202,
81,
2107,
273,
404,
31,
203,
377,
9506,
202,
724,
3465,
273,
2361,
18,
1896,
12,
724,
3465,
16,
662,
3465,
397,
525,
1769,
203,
377,
9506,
202,
11246,
273,
11681,
18,
588,
12,
2627,
338,
3950,
18,
39,
19474,
67,
7952,
16,
609,
2934,
14056,
5621,
203,
377,
9506,
202,
11246,
18,
542,
2555,
12,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
11134,
267,
2076,
31681,
2511,
24151,
2076,
25192,
364,
1623,
1965,
203,
377,
380,
7010,
377,
380,
632,
891,
202,
91,
203,
377,
380,
632,
891,
202,
91,
682,
203,
377,
380,
632,
2463,
202,
13174,
682,
32,
45,
3944,
34,
777,
326,
720,
2076,
2430,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
1bcc56fd7f73aa4dfd4cef278a5d938e016b96e4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/IDictionary.java | [
"Apache-2.0"
] | Java | fromString | Type | public static Type fromString(String type, Type defaultValue)
{
if ( type == null ) {
return defaultValue;
}
type = type.toLowerCase();
if ( "hashmap".equals(type) ) {
return Type.HASHMAP;
}
return defaultValue;
} | /**
* get the Type with the specified string name
*
* @param type (All lowercase string)
* @return Type
*/ | get the Type with the specified string name
@param type (All lowercase string)
@return Type | [
"get",
"the",
"Type",
"with",
"the",
"specified",
"string",
"name",
"@param",
"type",
"(",
"All",
"lowercase",
"string",
")",
"@return",
"Type"
] | public static Type fromString(String type, Type defaultValue)
{
if ( type == null ) {
return defaultValue;
}
type = type.toLowerCase();
if ( "hashmap".equals(type) ) {
return Type.HASHMAP;
}
return defaultValue;
} | [
"public",
"static",
"Type",
"fromString",
"(",
"String",
"type",
",",
"Type",
"defaultValue",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"type",
"=",
"type",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"\"hashmap\"",
".",
"equals",
"(",
"type",
")",
")",
"{",
"return",
"Type",
".",
"HASHMAP",
";",
"}",
"return",
"defaultValue",
";",
"}"
] | get the Type with the specified string name | [
"get",
"the",
"Type",
"with",
"the",
"specified",
"string",
"name"
] | [] | [
{
"param": "type",
"type": "String"
},
{
"param": "defaultValue",
"type": "Type"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "defaultValue",
"type": "Type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1412,
14855,
12,
780,
618,
16,
1412,
4593,
13,
203,
3639,
288,
203,
540,
202,
430,
261,
618,
422,
446,
262,
288,
203,
540,
202,
202,
2463,
4593,
31,
203,
540,
202,
97,
203,
540,
202,
203,
5411,
618,
273,
618,
18,
869,
5630,
5621,
203,
5411,
309,
261,
315,
2816,
1458,
9654,
14963,
12,
723,
13,
262,
288,
203,
7734,
327,
1412,
18,
15920,
8352,
31,
203,
5411,
289,
203,
2398,
203,
5411,
327,
4593,
31,
203,
3639,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
540,
380,
336,
326,
1412,
598,
326,
1269,
533,
508,
203,
540,
380,
7010,
540,
380,
632,
891,
282,
618,
261,
1595,
12400,
533,
13,
203,
540,
380,
632,
2463,
225,
1412,
203,
3639,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
82a1e5eaea4f57495b0360b164c4f9a28840b270 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java | [
"Apache-2.0"
] | Java | insertionSort | null | public static <T extends Comparable<? super T>> void insertionSort( T[] arr )
{
int j;
for ( int i = 1; i < arr.length; i++ ) {
T tmp = arr[i];
for ( j = i; j > 0 && tmp.compareTo(arr[j-1]) < 0; j--) {
arr[j] = arr[j-1];
}
if ( j < i ) arr[j] = tmp;
}
} | /**
* insert sort method
*
* @param arr an array of a comparable items
*/ | insert sort method
@param arr an array of a comparable items | [
"insert",
"sort",
"method",
"@param",
"arr",
"an",
"array",
"of",
"a",
"comparable",
"items"
] | public static <T extends Comparable<? super T>> void insertionSort( T[] arr )
{
int j;
for ( int i = 1; i < arr.length; i++ ) {
T tmp = arr[i];
for ( j = i; j > 0 && tmp.compareTo(arr[j-1]) < 0; j--) {
arr[j] = arr[j-1];
}
if ( j < i ) arr[j] = tmp;
}
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"insertionSort",
"(",
"T",
"[",
"]",
"arr",
")",
"{",
"int",
"j",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"arr",
".",
"length",
";",
"i",
"++",
")",
"{",
"T",
"tmp",
"=",
"arr",
"[",
"i",
"]",
";",
"for",
"(",
"j",
"=",
"i",
";",
"j",
">",
"0",
"&&",
"tmp",
".",
"compareTo",
"(",
"arr",
"[",
"j",
"-",
"1",
"]",
")",
"<",
"0",
";",
"j",
"--",
")",
"{",
"arr",
"[",
"j",
"]",
"=",
"arr",
"[",
"j",
"-",
"1",
"]",
";",
"}",
"if",
"(",
"j",
"<",
"i",
")",
"arr",
"[",
"j",
"]",
"=",
"tmp",
";",
"}",
"}"
] | insert sort method | [
"insert",
"sort",
"method"
] | [] | [
{
"param": "arr",
"type": "T[]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arr",
"type": "T[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
411,
56,
3231,
13633,
12880,
2240,
399,
9778,
918,
12626,
4416,
12,
399,
8526,
2454,
262,
203,
565,
288,
203,
3639,
509,
525,
31,
203,
3639,
364,
261,
509,
277,
273,
404,
31,
277,
411,
2454,
18,
2469,
31,
277,
9904,
262,
288,
203,
5411,
399,
1853,
273,
2454,
63,
77,
15533,
203,
5411,
364,
261,
525,
273,
277,
31,
525,
405,
374,
597,
1853,
18,
9877,
774,
12,
5399,
63,
78,
17,
21,
5717,
411,
374,
31,
525,
413,
13,
288,
203,
7734,
2454,
63,
78,
65,
273,
2454,
63,
78,
17,
21,
15533,
203,
5411,
289,
203,
2398,
203,
5411,
309,
261,
525,
411,
277,
262,
2454,
63,
78,
65,
273,
1853,
31,
7010,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2243,
1524,
707,
203,
377,
380,
7010,
377,
380,
632,
891,
2454,
392,
526,
434,
279,
25949,
1516,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
82a1e5eaea4f57495b0360b164c4f9a28840b270 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java | [
"Apache-2.0"
] | Java | shellSort | null | public static <T extends Comparable<? super T>> void shellSort( T[] arr )
{
int j, k = 0, gap;
for ( ; GAPS[k] < arr.length; k++ ) ;
while ( k-- > 0 ) {
gap = GAPS[k];
for ( int i = gap; i < arr.length; i++ ) {
T tmp = arr[ i ];
for ( j = i;
j >= gap && tmp.compareTo( arr[ j - gap ] ) < 0; j -= gap ) {
arr[ j ] = arr[ j - gap ];
}
if ( j < i ) arr[ j ] = tmp;
}
}
} | /**
* shell sort algorithm
*
* @param arr an array of Comparable items
*/ | shell sort algorithm
@param arr an array of Comparable items | [
"shell",
"sort",
"algorithm",
"@param",
"arr",
"an",
"array",
"of",
"Comparable",
"items"
] | public static <T extends Comparable<? super T>> void shellSort( T[] arr )
{
int j, k = 0, gap;
for ( ; GAPS[k] < arr.length; k++ ) ;
while ( k-- > 0 ) {
gap = GAPS[k];
for ( int i = gap; i < arr.length; i++ ) {
T tmp = arr[ i ];
for ( j = i;
j >= gap && tmp.compareTo( arr[ j - gap ] ) < 0; j -= gap ) {
arr[ j ] = arr[ j - gap ];
}
if ( j < i ) arr[ j ] = tmp;
}
}
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"shellSort",
"(",
"T",
"[",
"]",
"arr",
")",
"{",
"int",
"j",
",",
"k",
"=",
"0",
",",
"gap",
";",
"for",
"(",
";",
"GAPS",
"[",
"k",
"]",
"<",
"arr",
".",
"length",
";",
"k",
"++",
")",
";",
"while",
"(",
"k",
"--",
">",
"0",
")",
"{",
"gap",
"=",
"GAPS",
"[",
"k",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"gap",
";",
"i",
"<",
"arr",
".",
"length",
";",
"i",
"++",
")",
"{",
"T",
"tmp",
"=",
"arr",
"[",
"i",
"]",
";",
"for",
"(",
"j",
"=",
"i",
";",
"j",
">=",
"gap",
"&&",
"tmp",
".",
"compareTo",
"(",
"arr",
"[",
"j",
"-",
"gap",
"]",
")",
"<",
"0",
";",
"j",
"-=",
"gap",
")",
"{",
"arr",
"[",
"j",
"]",
"=",
"arr",
"[",
"j",
"-",
"gap",
"]",
";",
"}",
"if",
"(",
"j",
"<",
"i",
")",
"arr",
"[",
"j",
"]",
"=",
"tmp",
";",
"}",
"}",
"}"
] | shell sort algorithm | [
"shell",
"sort",
"algorithm"
] | [] | [
{
"param": "arr",
"type": "T[]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arr",
"type": "T[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
411,
56,
3231,
13633,
12880,
2240,
399,
9778,
918,
5972,
4416,
12,
399,
8526,
2454,
262,
203,
565,
288,
203,
3639,
509,
525,
16,
417,
273,
374,
16,
9300,
31,
203,
3639,
364,
261,
274,
611,
2203,
55,
63,
79,
65,
411,
2454,
18,
2469,
31,
417,
9904,
262,
274,
203,
540,
203,
3639,
1323,
261,
417,
413,
405,
374,
262,
288,
203,
5411,
9300,
273,
611,
2203,
55,
63,
79,
15533,
203,
5411,
364,
261,
509,
277,
273,
9300,
31,
277,
411,
2454,
18,
2469,
31,
277,
9904,
262,
288,
203,
7734,
399,
1853,
273,
2454,
63,
277,
308,
31,
203,
7734,
364,
261,
525,
273,
277,
31,
7010,
10792,
525,
1545,
9300,
597,
1853,
18,
9877,
774,
12,
2454,
63,
525,
300,
9300,
308,
262,
411,
374,
31,
525,
3947,
9300,
262,
288,
203,
10792,
2454,
63,
525,
308,
273,
2454,
63,
525,
300,
9300,
308,
31,
203,
7734,
289,
203,
7734,
309,
261,
525,
411,
277,
262,
2454,
63,
525,
308,
273,
1853,
31,
203,
5411,
289,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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1524,
4886,
203,
377,
380,
7010,
377,
380,
632,
891,
2454,
392,
526,
434,
13633,
1516,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
82a1e5eaea4f57495b0360b164c4f9a28840b270 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java | [
"Apache-2.0"
] | Java | mergeSort | null | @SuppressWarnings("unchecked")
public static <T extends Comparable<? super T>> void mergeSort( T[] arr )
{
/*if ( arr.length < 15 ) {
insertionSort( arr );
return;
}*/
T[] tmpArr = (T[]) new Comparable[arr.length];
mergeSort(arr, tmpArr, 0, arr.length - 1);
} | /**
* merge sort algorithm
*
* @param arr an array of Comparable item
*/ | merge sort algorithm
@param arr an array of Comparable item | [
"merge",
"sort",
"algorithm",
"@param",
"arr",
"an",
"array",
"of",
"Comparable",
"item"
] | @SuppressWarnings("unchecked")
public static <T extends Comparable<? super T>> void mergeSort( T[] arr )
{
/*if ( arr.length < 15 ) {
insertionSort( arr );
return;
}*/
T[] tmpArr = (T[]) new Comparable[arr.length];
mergeSort(arr, tmpArr, 0, arr.length - 1);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"mergeSort",
"(",
"T",
"[",
"]",
"arr",
")",
"{",
"/*if ( arr.length < 15 ) {\n insertionSort( arr );\n return;\n }*/",
"T",
"[",
"]",
"tmpArr",
"=",
"(",
"T",
"[",
"]",
")",
"new",
"Comparable",
"[",
"arr",
".",
"length",
"]",
";",
"mergeSort",
"(",
"arr",
",",
"tmpArr",
",",
"0",
",",
"arr",
".",
"length",
"-",
"1",
")",
";",
"}"
] | merge sort algorithm | [
"merge",
"sort",
"algorithm"
] | [] | [
{
"param": "arr",
"type": "T[]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arr",
"type": "T[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
29282,
4312,
2932,
5847,
7923,
203,
565,
1071,
760,
411,
56,
3231,
13633,
12880,
2240,
399,
9778,
918,
2691,
4416,
12,
399,
8526,
2454,
262,
203,
565,
288,
203,
3639,
1748,
430,
261,
2454,
18,
2469,
411,
4711,
262,
288,
203,
5411,
12626,
4416,
12,
2454,
11272,
203,
5411,
327,
31,
203,
3639,
289,
5549,
203,
540,
203,
3639,
399,
8526,
1853,
5715,
273,
261,
56,
63,
5717,
394,
13633,
63,
5399,
18,
2469,
15533,
203,
540,
203,
3639,
2691,
4416,
12,
5399,
16,
1853,
5715,
16,
374,
16,
2454,
18,
2469,
300,
404,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2691,
1524,
4886,
203,
377,
380,
7010,
377,
380,
632,
891,
2454,
392,
526,
434,
13633,
761,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
82a1e5eaea4f57495b0360b164c4f9a28840b270 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java | [
"Apache-2.0"
] | Java | mergeSort | null | private static <T extends Comparable<? super T>>
void mergeSort( T[] arr, T[] tmpArr, int left, int right )
{
//recursive way
if ( left < right ) {
int center = ( left + right ) / 2;
mergeSort(arr, tmpArr, left, center);
mergeSort(arr, tmpArr, center + 1, right);
merge(arr, tmpArr, left, center + 1, right);
}
//loop instead
/* int len = 2, pos;
int rpos, offset, cut;
while ( len <= right ) {
pos = 0;
offset = len / 2;
while ( pos + len <= right ) {
rpos = pos + offset;
merge( arr, tmpArr, pos, rpos, rpos + offset - 1 );
pos += len;
}
//merge the rest
cut = pos + offset;
if ( cut <= right )
merge( arr, tmpArr, pos, cut, right );
len *= 2;
}
merge( arr, tmpArr, 0, len / 2, right );*/
} | /**
* internal method to make a recursive call
*
* @param arr an array of Comparable items
* @param tmpArr temp array to placed the merged result
* @param left left-most index of the subarray
* @param right right-most index of the subarray
*/ | internal method to make a recursive call
@param arr an array of Comparable items
@param tmpArr temp array to placed the merged result
@param left left-most index of the subarray
@param right right-most index of the subarray | [
"internal",
"method",
"to",
"make",
"a",
"recursive",
"call",
"@param",
"arr",
"an",
"array",
"of",
"Comparable",
"items",
"@param",
"tmpArr",
"temp",
"array",
"to",
"placed",
"the",
"merged",
"result",
"@param",
"left",
"left",
"-",
"most",
"index",
"of",
"the",
"subarray",
"@param",
"right",
"right",
"-",
"most",
"index",
"of",
"the",
"subarray"
] | private static <T extends Comparable<? super T>>
void mergeSort( T[] arr, T[] tmpArr, int left, int right )
{
if ( left < right ) {
int center = ( left + right ) / 2;
mergeSort(arr, tmpArr, left, center);
mergeSort(arr, tmpArr, center + 1, right);
merge(arr, tmpArr, left, center + 1, right);
}
/* int len = 2, pos;
int rpos, offset, cut;
while ( len <= right ) {
pos = 0;
offset = len / 2;
while ( pos + len <= right ) {
rpos = pos + offset;
merge( arr, tmpArr, pos, rpos, rpos + offset - 1 );
pos += len;
}
//merge the rest
cut = pos + offset;
if ( cut <= right )
merge( arr, tmpArr, pos, cut, right );
len *= 2;
}
merge( arr, tmpArr, 0, len / 2, right );*/
} | [
"private",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"mergeSort",
"(",
"T",
"[",
"]",
"arr",
",",
"T",
"[",
"]",
"tmpArr",
",",
"int",
"left",
",",
"int",
"right",
")",
"{",
"if",
"(",
"left",
"<",
"right",
")",
"{",
"int",
"center",
"=",
"(",
"left",
"+",
"right",
")",
"/",
"2",
";",
"mergeSort",
"(",
"arr",
",",
"tmpArr",
",",
"left",
",",
"center",
")",
";",
"mergeSort",
"(",
"arr",
",",
"tmpArr",
",",
"center",
"+",
"1",
",",
"right",
")",
";",
"merge",
"(",
"arr",
",",
"tmpArr",
",",
"left",
",",
"center",
"+",
"1",
",",
"right",
")",
";",
"}",
"/* int len = 2, pos;\n int rpos, offset, cut;\n while ( len <= right ) {\n pos = 0;\n offset = len / 2;\n while ( pos + len <= right ) {\n rpos = pos + offset;\n merge( arr, tmpArr, pos, rpos, rpos + offset - 1 );\n pos += len;\n }\n \n //merge the rest\n cut = pos + offset;\n if ( cut <= right ) \n merge( arr, tmpArr, pos, cut, right );\n \n len *= 2;\n }\n merge( arr, tmpArr, 0, len / 2, right );*/",
"}"
] | internal method to make a recursive call | [
"internal",
"method",
"to",
"make",
"a",
"recursive",
"call"
] | [
"//recursive way",
"//loop instead"
] | [
{
"param": "arr",
"type": "T[]"
},
{
"param": "tmpArr",
"type": "T[]"
},
{
"param": "left",
"type": "int"
},
{
"param": "right",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arr",
"type": "T[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tmpArr",
"type": "T[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "left",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "right",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
760,
411,
56,
3231,
13633,
12880,
2240,
399,
9778,
7010,
565,
918,
2691,
4416,
12,
399,
8526,
2454,
16,
399,
8526,
1853,
5715,
16,
509,
2002,
16,
509,
2145,
262,
203,
565,
288,
203,
3639,
368,
10543,
4031,
203,
3639,
309,
261,
2002,
411,
2145,
262,
288,
203,
5411,
509,
4617,
273,
261,
2002,
397,
2145,
262,
342,
576,
31,
203,
5411,
2691,
4416,
12,
5399,
16,
1853,
5715,
16,
2002,
16,
4617,
1769,
203,
5411,
2691,
4416,
12,
5399,
16,
1853,
5715,
16,
4617,
397,
404,
16,
2145,
1769,
203,
5411,
2691,
12,
5399,
16,
1853,
5715,
16,
2002,
16,
4617,
397,
404,
16,
2145,
1769,
203,
3639,
289,
203,
540,
203,
3639,
368,
6498,
3560,
203,
20308,
3639,
509,
562,
273,
576,
16,
949,
31,
203,
3639,
509,
436,
917,
16,
1384,
16,
6391,
31,
203,
3639,
1323,
261,
562,
1648,
2145,
262,
288,
203,
5411,
949,
273,
374,
31,
203,
5411,
1384,
273,
562,
342,
576,
31,
203,
5411,
1323,
261,
949,
397,
562,
1648,
2145,
225,
262,
288,
203,
7734,
436,
917,
273,
949,
397,
1384,
31,
203,
7734,
2691,
12,
2454,
16,
1853,
5715,
16,
949,
16,
436,
917,
16,
436,
917,
397,
1384,
300,
404,
11272,
203,
7734,
949,
1011,
562,
31,
203,
5411,
289,
203,
2398,
203,
5411,
368,
2702,
326,
3127,
203,
5411,
6391,
273,
949,
397,
1384,
31,
203,
5411,
309,
261,
6391,
1648,
2145,
262,
7010,
7734,
2691,
12,
2454,
16,
1853,
5715,
16,
949,
16,
6391,
16,
2145,
11272,
203,
2398,
203,
5411,
562,
6413,
576,
31,
203,
3639,
289,
203,
3639,
2691,
12,
2454,
16,
1853,
5715,
16,
374,
16,
562,
342,
576,
16,
2145,
11272,
5549,
203,
565,
289,
2,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2713,
707,
358,
1221,
279,
5904,
745,
203,
377,
380,
7010,
377,
380,
632,
891,
2454,
392,
526,
434,
13633,
1516,
203,
377,
380,
632,
891,
1853,
5715,
1906,
526,
358,
15235,
326,
5384,
563,
203,
377,
380,
632,
891,
2002,
2002,
17,
10329,
770,
434,
326,
720,
1126,
203,
377,
380,
632,
891,
2145,
2145,
17,
10329,
770,
434,
326,
720,
1126,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
82a1e5eaea4f57495b0360b164c4f9a28840b270 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java | [
"Apache-2.0"
] | Java | merge | null | private static <T extends Comparable<? super T>>
void merge( T[] arr, T[] tmpArr, int lPos, int rPos, int rEnd )
{
int lEnd = rPos - 1;
int tPos = lPos;
int leftTmp = lPos;
while ( lPos <= lEnd && rPos <= rEnd ) {
if ( arr[lPos].compareTo( arr[rPos] ) <= 0 ) {
tmpArr[ tPos++ ] = arr[ lPos++ ];
} else {
tmpArr[ tPos++ ] = arr[ rPos++ ];
}
}
//copy the rest element of the left half subarray.
while ( lPos <= lEnd ) {
tmpArr[ tPos++ ] = arr[ lPos++ ];
}
//copy the rest elements of the right half subarray. (only one loop will be execute)
while ( rPos <= rEnd ) {
tmpArr[ tPos++ ] = arr[ rPos++ ];
}
//copy the tmpArr back cause we need to change the arr array items.
for ( ; rEnd >= leftTmp; rEnd-- ) {
arr[rEnd] = tmpArr[rEnd];
}
} | /**
* internal method to merge the sorted halves of a subarray
*
* @param arr an array of Comparable items
* @param tmpArr temp array to placed the merged result
* @param leftPos left-most index of the subarray
* @param rightPos right start index of the subarray
* @param endPos right-most index of the subarray
*/ | internal method to merge the sorted halves of a subarray
| [
"internal",
"method",
"to",
"merge",
"the",
"sorted",
"halves",
"of",
"a",
"subarray"
] | private static <T extends Comparable<? super T>>
void merge( T[] arr, T[] tmpArr, int lPos, int rPos, int rEnd )
{
int lEnd = rPos - 1;
int tPos = lPos;
int leftTmp = lPos;
while ( lPos <= lEnd && rPos <= rEnd ) {
if ( arr[lPos].compareTo( arr[rPos] ) <= 0 ) {
tmpArr[ tPos++ ] = arr[ lPos++ ];
} else {
tmpArr[ tPos++ ] = arr[ rPos++ ];
}
}
while ( lPos <= lEnd ) {
tmpArr[ tPos++ ] = arr[ lPos++ ];
}
while ( rPos <= rEnd ) {
tmpArr[ tPos++ ] = arr[ rPos++ ];
}
for ( ; rEnd >= leftTmp; rEnd-- ) {
arr[rEnd] = tmpArr[rEnd];
}
} | [
"private",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"merge",
"(",
"T",
"[",
"]",
"arr",
",",
"T",
"[",
"]",
"tmpArr",
",",
"int",
"lPos",
",",
"int",
"rPos",
",",
"int",
"rEnd",
")",
"{",
"int",
"lEnd",
"=",
"rPos",
"-",
"1",
";",
"int",
"tPos",
"=",
"lPos",
";",
"int",
"leftTmp",
"=",
"lPos",
";",
"while",
"(",
"lPos",
"<=",
"lEnd",
"&&",
"rPos",
"<=",
"rEnd",
")",
"{",
"if",
"(",
"arr",
"[",
"lPos",
"]",
".",
"compareTo",
"(",
"arr",
"[",
"rPos",
"]",
")",
"<=",
"0",
")",
"{",
"tmpArr",
"[",
"tPos",
"++",
"]",
"=",
"arr",
"[",
"lPos",
"++",
"]",
";",
"}",
"else",
"{",
"tmpArr",
"[",
"tPos",
"++",
"]",
"=",
"arr",
"[",
"rPos",
"++",
"]",
";",
"}",
"}",
"while",
"(",
"lPos",
"<=",
"lEnd",
")",
"{",
"tmpArr",
"[",
"tPos",
"++",
"]",
"=",
"arr",
"[",
"lPos",
"++",
"]",
";",
"}",
"while",
"(",
"rPos",
"<=",
"rEnd",
")",
"{",
"tmpArr",
"[",
"tPos",
"++",
"]",
"=",
"arr",
"[",
"rPos",
"++",
"]",
";",
"}",
"for",
"(",
";",
"rEnd",
">=",
"leftTmp",
";",
"rEnd",
"--",
")",
"{",
"arr",
"[",
"rEnd",
"]",
"=",
"tmpArr",
"[",
"rEnd",
"]",
";",
"}",
"}"
] | internal method to merge the sorted halves of a subarray | [
"internal",
"method",
"to",
"merge",
"the",
"sorted",
"halves",
"of",
"a",
"subarray"
] | [
"//copy the rest element of the left half subarray.",
"//copy the rest elements of the right half subarray. (only one loop will be execute)",
"//copy the tmpArr back cause we need to change the arr array items."
] | [
{
"param": "arr",
"type": "T[]"
},
{
"param": "tmpArr",
"type": "T[]"
},
{
"param": "lPos",
"type": "int"
},
{
"param": "rPos",
"type": "int"
},
{
"param": "rEnd",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arr",
"type": "T[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tmpArr",
"type": "T[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lPos",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rPos",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rEnd",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
760,
411,
56,
3231,
13633,
12880,
2240,
399,
9778,
203,
565,
918,
2691,
12,
399,
8526,
2454,
16,
399,
8526,
1853,
5715,
16,
509,
328,
1616,
16,
509,
436,
1616,
16,
509,
436,
1638,
262,
203,
565,
288,
203,
3639,
509,
328,
1638,
273,
436,
1616,
300,
404,
31,
203,
3639,
509,
268,
1616,
273,
328,
1616,
31,
203,
3639,
509,
2002,
9161,
273,
328,
1616,
31,
203,
540,
203,
3639,
1323,
261,
328,
1616,
1648,
328,
1638,
597,
436,
1616,
1648,
436,
1638,
225,
262,
288,
203,
5411,
309,
261,
2454,
63,
80,
1616,
8009,
9877,
774,
12,
2454,
63,
86,
1616,
65,
262,
1648,
374,
262,
288,
203,
7734,
1853,
5715,
63,
268,
1616,
9904,
308,
273,
2454,
63,
328,
1616,
9904,
308,
31,
203,
5411,
289,
469,
288,
203,
7734,
1853,
5715,
63,
268,
1616,
9904,
308,
273,
2454,
63,
436,
1616,
9904,
308,
31,
203,
5411,
289,
203,
3639,
289,
203,
540,
203,
3639,
368,
3530,
326,
3127,
930,
434,
326,
2002,
8816,
720,
1126,
18,
203,
3639,
1323,
261,
328,
1616,
1648,
328,
1638,
262,
288,
203,
5411,
1853,
5715,
63,
268,
1616,
9904,
308,
273,
2454,
63,
328,
1616,
9904,
308,
31,
203,
3639,
289,
203,
540,
203,
3639,
368,
3530,
326,
3127,
2186,
434,
326,
2145,
8816,
720,
1126,
18,
261,
3700,
1245,
2798,
903,
506,
1836,
13,
203,
3639,
1323,
261,
436,
1616,
1648,
436,
1638,
262,
288,
203,
5411,
1853,
5715,
63,
268,
1616,
9904,
308,
273,
2454,
63,
436,
1616,
9904,
308,
31,
203,
3639,
289,
203,
540,
203,
3639,
368,
3530,
326,
1853,
5715,
1473,
4620,
732,
1608,
358,
2549,
326,
2454,
526,
1516,
18,
203,
3639,
364,
261,
274,
436,
1638,
1545,
2002,
9161,
31,
436,
1638,
413,
262,
288,
203,
5411,
2454,
63,
86,
1638,
65,
273,
1853,
5715,
63,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2713,
707,
358,
2691,
326,
3115,
19514,
3324,
434,
279,
720,
1126,
203,
377,
380,
7010,
377,
380,
632,
891,
2454,
392,
526,
434,
13633,
1516,
203,
377,
380,
632,
891,
1853,
5715,
1906,
526,
358,
15235,
326,
5384,
563,
203,
377,
380,
632,
891,
2002,
1616,
2002,
17,
10329,
770,
434,
326,
720,
1126,
203,
377,
380,
632,
891,
2145,
1616,
2145,
787,
770,
434,
326,
720,
1126,
203,
377,
380,
632,
891,
19809,
2145,
17,
10329,
770,
434,
326,
720,
1126,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
82a1e5eaea4f57495b0360b164c4f9a28840b270 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java | [
"Apache-2.0"
] | Java | swapReferences | null | private static <T> void swapReferences( T[] arr, int idx1, int idx2 )
{
T tmp = arr[idx1];
arr[idx1] = arr[idx2];
arr[idx2] = tmp;
} | /**
* method to swap elements in an array
*
* @param arr an array of Objects
* @param idx1 the index of the first element
* @param idx2 the index of the second element
*/ | method to swap elements in an array
@param arr an array of Objects
@param idx1 the index of the first element
@param idx2 the index of the second element | [
"method",
"to",
"swap",
"elements",
"in",
"an",
"array",
"@param",
"arr",
"an",
"array",
"of",
"Objects",
"@param",
"idx1",
"the",
"index",
"of",
"the",
"first",
"element",
"@param",
"idx2",
"the",
"index",
"of",
"the",
"second",
"element"
] | private static <T> void swapReferences( T[] arr, int idx1, int idx2 )
{
T tmp = arr[idx1];
arr[idx1] = arr[idx2];
arr[idx2] = tmp;
} | [
"private",
"static",
"<",
"T",
">",
"void",
"swapReferences",
"(",
"T",
"[",
"]",
"arr",
",",
"int",
"idx1",
",",
"int",
"idx2",
")",
"{",
"T",
"tmp",
"=",
"arr",
"[",
"idx1",
"]",
";",
"arr",
"[",
"idx1",
"]",
"=",
"arr",
"[",
"idx2",
"]",
";",
"arr",
"[",
"idx2",
"]",
"=",
"tmp",
";",
"}"
] | method to swap elements in an array | [
"method",
"to",
"swap",
"elements",
"in",
"an",
"array"
] | [] | [
{
"param": "arr",
"type": "T[]"
},
{
"param": "idx1",
"type": "int"
},
{
"param": "idx2",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arr",
"type": "T[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "idx1",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "idx2",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
760,
411,
56,
34,
918,
7720,
8221,
12,
399,
8526,
2454,
16,
509,
2067,
21,
16,
509,
2067,
22,
262,
203,
565,
288,
203,
3639,
399,
1853,
273,
2454,
63,
3465,
21,
15533,
203,
3639,
2454,
63,
3465,
21,
65,
273,
2454,
63,
3465,
22,
15533,
203,
3639,
2454,
63,
3465,
22,
65,
273,
1853,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
707,
358,
7720,
2186,
316,
392,
526,
203,
377,
380,
7010,
377,
380,
632,
891,
2454,
392,
526,
434,
8487,
203,
377,
380,
632,
891,
2067,
21,
326,
770,
434,
326,
1122,
930,
203,
377,
380,
632,
891,
2067,
22,
326,
770,
434,
326,
2205,
930,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
82a1e5eaea4f57495b0360b164c4f9a28840b270 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java | [
"Apache-2.0"
] | Java | median | T | private static <T extends Comparable<? super T>>
T median( T[] arr, int left, int right )
{
int center = ( left + right ) / 2;
if ( arr[left].compareTo( arr[center] ) > 0 )
swapReferences( arr, left, center );
if ( arr[left].compareTo( arr[right] ) > 0 )
swapReferences( arr, left, right );
if ( arr[center].compareTo( arr[right] ) > 0 )
swapReferences( arr, center, right );
swapReferences( arr, center, right - 1 );
return arr[ right - 1 ];
} | /**
* <p>
* get the median of the left, center and right
* order these and hide the pivot by put it the end of of the array
* </p>
*
* @param arr an array of Comparable
* @param left the most-left index of the subarray
* @param right the most-right index of the subarray
* @return T
*/ |
get the median of the left, center and right
order these and hide the pivot by put it the end of of the array
@param arr an array of Comparable
@param left the most-left index of the subarray
@param right the most-right index of the subarray
@return T | [
"get",
"the",
"median",
"of",
"the",
"left",
"center",
"and",
"right",
"order",
"these",
"and",
"hide",
"the",
"pivot",
"by",
"put",
"it",
"the",
"end",
"of",
"of",
"the",
"array",
"@param",
"arr",
"an",
"array",
"of",
"Comparable",
"@param",
"left",
"the",
"most",
"-",
"left",
"index",
"of",
"the",
"subarray",
"@param",
"right",
"the",
"most",
"-",
"right",
"index",
"of",
"the",
"subarray",
"@return",
"T"
] | private static <T extends Comparable<? super T>>
T median( T[] arr, int left, int right )
{
int center = ( left + right ) / 2;
if ( arr[left].compareTo( arr[center] ) > 0 )
swapReferences( arr, left, center );
if ( arr[left].compareTo( arr[right] ) > 0 )
swapReferences( arr, left, right );
if ( arr[center].compareTo( arr[right] ) > 0 )
swapReferences( arr, center, right );
swapReferences( arr, center, right - 1 );
return arr[ right - 1 ];
} | [
"private",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"T",
"median",
"(",
"T",
"[",
"]",
"arr",
",",
"int",
"left",
",",
"int",
"right",
")",
"{",
"int",
"center",
"=",
"(",
"left",
"+",
"right",
")",
"/",
"2",
";",
"if",
"(",
"arr",
"[",
"left",
"]",
".",
"compareTo",
"(",
"arr",
"[",
"center",
"]",
")",
">",
"0",
")",
"swapReferences",
"(",
"arr",
",",
"left",
",",
"center",
")",
";",
"if",
"(",
"arr",
"[",
"left",
"]",
".",
"compareTo",
"(",
"arr",
"[",
"right",
"]",
")",
">",
"0",
")",
"swapReferences",
"(",
"arr",
",",
"left",
",",
"right",
")",
";",
"if",
"(",
"arr",
"[",
"center",
"]",
".",
"compareTo",
"(",
"arr",
"[",
"right",
"]",
")",
">",
"0",
")",
"swapReferences",
"(",
"arr",
",",
"center",
",",
"right",
")",
";",
"swapReferences",
"(",
"arr",
",",
"center",
",",
"right",
"-",
"1",
")",
";",
"return",
"arr",
"[",
"right",
"-",
"1",
"]",
";",
"}"
] | <p>
get the median of the left, center and right
order these and hide the pivot by put it the end of of the array
</p> | [
"<p",
">",
"get",
"the",
"median",
"of",
"the",
"left",
"center",
"and",
"right",
"order",
"these",
"and",
"hide",
"the",
"pivot",
"by",
"put",
"it",
"the",
"end",
"of",
"of",
"the",
"array",
"<",
"/",
"p",
">"
] | [] | [
{
"param": "arr",
"type": "T[]"
},
{
"param": "left",
"type": "int"
},
{
"param": "right",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arr",
"type": "T[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "left",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "right",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
760,
411,
56,
3231,
13633,
12880,
2240,
399,
9778,
203,
565,
399,
12644,
12,
399,
8526,
2454,
16,
509,
2002,
16,
509,
2145,
262,
203,
565,
288,
203,
3639,
509,
4617,
273,
261,
2002,
397,
2145,
262,
342,
576,
31,
203,
540,
203,
3639,
309,
261,
2454,
63,
4482,
8009,
9877,
774,
12,
2454,
63,
5693,
65,
262,
405,
374,
262,
203,
5411,
7720,
8221,
12,
2454,
16,
2002,
16,
4617,
11272,
203,
3639,
309,
261,
2454,
63,
4482,
8009,
9877,
774,
12,
2454,
63,
4083,
65,
262,
405,
374,
262,
203,
5411,
7720,
8221,
12,
2454,
16,
2002,
16,
2145,
11272,
203,
3639,
309,
261,
2454,
63,
5693,
8009,
9877,
774,
12,
2454,
63,
4083,
65,
262,
405,
374,
262,
203,
5411,
7720,
8221,
12,
2454,
16,
4617,
16,
2145,
11272,
203,
540,
203,
3639,
7720,
8221,
12,
2454,
16,
4617,
16,
2145,
300,
404,
11272,
203,
3639,
327,
2454,
63,
2145,
300,
404,
308,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
4617,
471,
2145,
203,
377,
380,
1353,
4259,
471,
6853,
326,
9939,
635,
1378,
518,
326,
679,
434,
434,
326,
526,
203,
377,
380,
7765,
84,
34,
203,
377,
380,
7010,
377,
380,
632,
891,
2454,
392,
526,
434,
13633,
203,
377,
380,
632,
891,
2002,
326,
4486,
17,
4482,
770,
434,
326,
720,
1126,
203,
377,
380,
632,
891,
2145,
326,
4486,
17,
4083,
770,
434,
326,
720,
1126,
203,
377,
380,
632,
2463,
399,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
82a1e5eaea4f57495b0360b164c4f9a28840b270 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java | [
"Apache-2.0"
] | Java | insertionSort | null | public static <T extends Comparable<? super T>>
void insertionSort( T[] arr, int start, int end )
{
int i;
for ( int j = start + 1; j <= end; j++ ) {
T tmp = arr[j];
for ( i = j; i > start && tmp.compareTo( arr[i - 1] ) < 0; i-- ) {
arr[ i ] = arr[ i - 1 ];
}
if ( i < j ) arr[ i ] = tmp;
}
} | /**
* method to sort an subarray from start to end with insertion sort algorithm
*
* @param arr an array of Comparable items
* @param start the begining position
* @param end the end position
*/ | method to sort an subarray from start to end with insertion sort algorithm
@param arr an array of Comparable items
@param start the begining position
@param end the end position | [
"method",
"to",
"sort",
"an",
"subarray",
"from",
"start",
"to",
"end",
"with",
"insertion",
"sort",
"algorithm",
"@param",
"arr",
"an",
"array",
"of",
"Comparable",
"items",
"@param",
"start",
"the",
"begining",
"position",
"@param",
"end",
"the",
"end",
"position"
] | public static <T extends Comparable<? super T>>
void insertionSort( T[] arr, int start, int end )
{
int i;
for ( int j = start + 1; j <= end; j++ ) {
T tmp = arr[j];
for ( i = j; i > start && tmp.compareTo( arr[i - 1] ) < 0; i-- ) {
arr[ i ] = arr[ i - 1 ];
}
if ( i < j ) arr[ i ] = tmp;
}
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"insertionSort",
"(",
"T",
"[",
"]",
"arr",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"int",
"i",
";",
"for",
"(",
"int",
"j",
"=",
"start",
"+",
"1",
";",
"j",
"<=",
"end",
";",
"j",
"++",
")",
"{",
"T",
"tmp",
"=",
"arr",
"[",
"j",
"]",
";",
"for",
"(",
"i",
"=",
"j",
";",
"i",
">",
"start",
"&&",
"tmp",
".",
"compareTo",
"(",
"arr",
"[",
"i",
"-",
"1",
"]",
")",
"<",
"0",
";",
"i",
"--",
")",
"{",
"arr",
"[",
"i",
"]",
"=",
"arr",
"[",
"i",
"-",
"1",
"]",
";",
"}",
"if",
"(",
"i",
"<",
"j",
")",
"arr",
"[",
"i",
"]",
"=",
"tmp",
";",
"}",
"}"
] | method to sort an subarray from start to end with insertion sort algorithm | [
"method",
"to",
"sort",
"an",
"subarray",
"from",
"start",
"to",
"end",
"with",
"insertion",
"sort",
"algorithm"
] | [] | [
{
"param": "arr",
"type": "T[]"
},
{
"param": "start",
"type": "int"
},
{
"param": "end",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arr",
"type": "T[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "start",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "end",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
411,
56,
3231,
13633,
12880,
2240,
399,
9778,
7010,
565,
918,
12626,
4416,
12,
399,
8526,
2454,
16,
509,
787,
16,
509,
679,
262,
203,
565,
288,
203,
3639,
509,
277,
31,
203,
3639,
364,
261,
509,
525,
273,
787,
397,
404,
31,
525,
1648,
679,
31,
525,
9904,
262,
288,
203,
5411,
399,
1853,
273,
2454,
63,
78,
15533,
203,
5411,
364,
261,
277,
273,
525,
31,
277,
405,
787,
597,
1853,
18,
9877,
774,
12,
2454,
63,
77,
300,
404,
65,
262,
411,
374,
31,
277,
413,
262,
288,
203,
7734,
2454,
63,
277,
308,
273,
2454,
63,
277,
300,
404,
308,
31,
203,
5411,
289,
203,
5411,
309,
261,
277,
411,
525,
262,
2454,
63,
277,
308,
273,
1853,
31,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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326,
2376,
310,
1754,
203,
377,
380,
632,
891,
679,
326,
679,
1754,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
82a1e5eaea4f57495b0360b164c4f9a28840b270 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java | [
"Apache-2.0"
] | Java | quicksort | null | private static <T extends Comparable<? super T>>
void quicksort( T[] arr, int left, int right )
{
if ( left + CUTOFF <= right ) {
//find the pivot
T pivot = median( arr, left, right );
//start partitioning
int i = left, j = right - 1;
for ( ; ; ) {
while ( arr[++i].compareTo( pivot ) < 0 ) ;
while ( arr[--j].compareTo( pivot ) > 0 ) ;
if ( i < j ) {
swapReferences( arr, i, j );
} else {
break;
}
}
//swap the pivot reference back to the small collection.
swapReferences( arr, i, right - 1 );
quicksort( arr, left, i - 1 ); //sort the small collection.
quicksort( arr, i + 1, right ); //sort the large collection.
} else {
//if the total number is less than CUTOFF we use insertion sort instead.
insertionSort( arr, left, right );
}
} | /**
* internal method to sort the array with quick sort algorithm
*
* @param arr an array of Comparable Items
* @param left the left-most index of the subarray
* @param right the right-most index of the subarray
*/ | internal method to sort the array with quick sort algorithm
@param arr an array of Comparable Items
@param left the left-most index of the subarray
@param right the right-most index of the subarray | [
"internal",
"method",
"to",
"sort",
"the",
"array",
"with",
"quick",
"sort",
"algorithm",
"@param",
"arr",
"an",
"array",
"of",
"Comparable",
"Items",
"@param",
"left",
"the",
"left",
"-",
"most",
"index",
"of",
"the",
"subarray",
"@param",
"right",
"the",
"right",
"-",
"most",
"index",
"of",
"the",
"subarray"
] | private static <T extends Comparable<? super T>>
void quicksort( T[] arr, int left, int right )
{
if ( left + CUTOFF <= right ) {
T pivot = median( arr, left, right );
int i = left, j = right - 1;
for ( ; ; ) {
while ( arr[++i].compareTo( pivot ) < 0 ) ;
while ( arr[--j].compareTo( pivot ) > 0 ) ;
if ( i < j ) {
swapReferences( arr, i, j );
} else {
break;
}
}
swapReferences( arr, i, right - 1 );
quicksort( arr, left, i - 1 );
quicksort( arr, i + 1, right );
} else {
insertionSort( arr, left, right );
}
} | [
"private",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"quicksort",
"(",
"T",
"[",
"]",
"arr",
",",
"int",
"left",
",",
"int",
"right",
")",
"{",
"if",
"(",
"left",
"+",
"CUTOFF",
"<=",
"right",
")",
"{",
"T",
"pivot",
"=",
"median",
"(",
"arr",
",",
"left",
",",
"right",
")",
";",
"int",
"i",
"=",
"left",
",",
"j",
"=",
"right",
"-",
"1",
";",
"for",
"(",
";",
";",
")",
"{",
"while",
"(",
"arr",
"[",
"++",
"i",
"]",
".",
"compareTo",
"(",
"pivot",
")",
"<",
"0",
")",
";",
"while",
"(",
"arr",
"[",
"--",
"j",
"]",
".",
"compareTo",
"(",
"pivot",
")",
">",
"0",
")",
";",
"if",
"(",
"i",
"<",
"j",
")",
"{",
"swapReferences",
"(",
"arr",
",",
"i",
",",
"j",
")",
";",
"}",
"else",
"{",
"break",
";",
"}",
"}",
"swapReferences",
"(",
"arr",
",",
"i",
",",
"right",
"-",
"1",
")",
";",
"quicksort",
"(",
"arr",
",",
"left",
",",
"i",
"-",
"1",
")",
";",
"quicksort",
"(",
"arr",
",",
"i",
"+",
"1",
",",
"right",
")",
";",
"}",
"else",
"{",
"insertionSort",
"(",
"arr",
",",
"left",
",",
"right",
")",
";",
"}",
"}"
] | internal method to sort the array with quick sort algorithm | [
"internal",
"method",
"to",
"sort",
"the",
"array",
"with",
"quick",
"sort",
"algorithm"
] | [
"//find the pivot",
"//start partitioning",
"//swap the pivot reference back to the small collection.",
"//sort the small collection.",
"//sort the large collection.",
"//if the total number is less than CUTOFF we use insertion sort instead."
] | [
{
"param": "arr",
"type": "T[]"
},
{
"param": "left",
"type": "int"
},
{
"param": "right",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arr",
"type": "T[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "left",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "right",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
760,
411,
56,
3231,
13633,
12880,
2240,
399,
9778,
7010,
565,
918,
9549,
3804,
12,
399,
8526,
2454,
16,
509,
2002,
16,
509,
2145,
262,
203,
565,
288,
203,
3639,
309,
261,
2002,
397,
385,
1693,
8797,
1648,
2145,
225,
262,
288,
203,
5411,
368,
4720,
326,
9939,
203,
5411,
399,
9939,
273,
12644,
12,
2454,
16,
2002,
16,
2145,
11272,
203,
2398,
203,
5411,
368,
1937,
3590,
310,
203,
5411,
509,
277,
273,
2002,
16,
525,
273,
2145,
300,
404,
31,
203,
5411,
364,
261,
274,
274,
262,
288,
203,
7734,
1323,
261,
2454,
63,
9904,
77,
8009,
9877,
774,
12,
9939,
262,
411,
374,
262,
274,
203,
7734,
1323,
261,
2454,
63,
413,
78,
8009,
9877,
774,
12,
9939,
262,
405,
374,
262,
274,
203,
7734,
309,
261,
277,
411,
525,
262,
288,
203,
10792,
7720,
8221,
12,
2454,
16,
277,
16,
525,
11272,
203,
7734,
289,
469,
288,
203,
10792,
898,
31,
203,
7734,
289,
203,
5411,
289,
203,
2398,
203,
5411,
368,
22270,
326,
9939,
2114,
1473,
358,
326,
5264,
1849,
18,
203,
5411,
7720,
8221,
12,
2454,
16,
277,
16,
2145,
300,
404,
11272,
203,
2398,
203,
5411,
9549,
3804,
12,
2454,
16,
2002,
16,
277,
300,
404,
11272,
3639,
368,
3804,
326,
5264,
1849,
18,
203,
5411,
9549,
3804,
12,
2454,
16,
277,
397,
404,
16,
2145,
11272,
3639,
368,
3804,
326,
7876,
1849,
18,
203,
2398,
203,
3639,
289,
469,
288,
203,
5411,
368,
430,
326,
2078,
1300,
353,
5242,
2353,
385,
1693,
8797,
732,
999,
12626,
1524,
3560,
18,
203,
5411,
12626,
4416,
12,
2454,
16,
2002,
16,
2145,
11272,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2713,
707,
358,
1524,
326,
526,
598,
9549,
1524,
4886,
203,
377,
380,
7010,
377,
380,
632,
891,
2454,
392,
526,
434,
13633,
10240,
203,
377,
380,
632,
891,
2002,
326,
2002,
17,
10329,
770,
434,
326,
720,
1126,
203,
377,
380,
632,
891,
2145,
326,
2145,
17,
10329,
770,
434,
326,
720,
1126,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
82a1e5eaea4f57495b0360b164c4f9a28840b270 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java | [
"Apache-2.0"
] | Java | quickSelect | null | public static <T extends Comparable<? super T>>
void quickSelect( T[] arr, int k )
{
quickSelect( arr, 0, arr.length - 1, k );
} | /**
* quick select algorithm
*
* @param arr an array of Comparable items
* @param k the k-th small index
*/ | quick select algorithm
@param arr an array of Comparable items
@param k the k-th small index | [
"quick",
"select",
"algorithm",
"@param",
"arr",
"an",
"array",
"of",
"Comparable",
"items",
"@param",
"k",
"the",
"k",
"-",
"th",
"small",
"index"
] | public static <T extends Comparable<? super T>>
void quickSelect( T[] arr, int k )
{
quickSelect( arr, 0, arr.length - 1, k );
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"quickSelect",
"(",
"T",
"[",
"]",
"arr",
",",
"int",
"k",
")",
"{",
"quickSelect",
"(",
"arr",
",",
"0",
",",
"arr",
".",
"length",
"-",
"1",
",",
"k",
")",
";",
"}"
] | quick select algorithm | [
"quick",
"select",
"algorithm"
] | [] | [
{
"param": "arr",
"type": "T[]"
},
{
"param": "k",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arr",
"type": "T[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "k",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
411,
56,
3231,
13633,
12880,
2240,
399,
9778,
203,
565,
918,
9549,
3391,
12,
399,
8526,
2454,
16,
509,
417,
262,
203,
565,
288,
203,
3639,
9549,
3391,
12,
2454,
16,
374,
16,
2454,
18,
2469,
300,
404,
16,
417,
11272,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
9549,
2027,
4886,
203,
377,
380,
7010,
377,
380,
632,
891,
2454,
392,
526,
434,
13633,
1516,
203,
377,
380,
632,
891,
417,
326,
417,
17,
451,
5264,
770,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
82a1e5eaea4f57495b0360b164c4f9a28840b270 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java | [
"Apache-2.0"
] | Java | quickSelect | null | private static <T extends Comparable<? super T>>
void quickSelect( T[] arr, int left, int right, int k )
{
if ( left + CUTOFF <= right ) {
//find the pivot
T pivot = median( arr, left, right );
int i = left, j = right - 1;
for ( ; ; ) {
while ( arr[ ++i ].compareTo( pivot ) < 0 ) ;
while ( arr[ --j ].compareTo( pivot ) > 0 ) ;
if ( i < j )
swapReferences( arr, i, j );
else
break;
}
//swap the pivot
swapReferences( arr, i, right - 1 );
if ( k <= i )
quickSelect( arr, left, i - 1, k );
else if ( k > i + 1 )
quickSelect( arr, i + 1, right, k );
} else {
insertionSort( arr, left, right );
}
} | /**
* internal method to find the Kth small element for the given array
*
* @param arr an array of Comparable items
* @param left the left-most index of the subarray
* @param right the right-most index of the subarray
* @param k the k-th small element
*/ | internal method to find the Kth small element for the given array
@param arr an array of Comparable items
@param left the left-most index of the subarray
@param right the right-most index of the subarray
@param k the k-th small element | [
"internal",
"method",
"to",
"find",
"the",
"Kth",
"small",
"element",
"for",
"the",
"given",
"array",
"@param",
"arr",
"an",
"array",
"of",
"Comparable",
"items",
"@param",
"left",
"the",
"left",
"-",
"most",
"index",
"of",
"the",
"subarray",
"@param",
"right",
"the",
"right",
"-",
"most",
"index",
"of",
"the",
"subarray",
"@param",
"k",
"the",
"k",
"-",
"th",
"small",
"element"
] | private static <T extends Comparable<? super T>>
void quickSelect( T[] arr, int left, int right, int k )
{
if ( left + CUTOFF <= right ) {
T pivot = median( arr, left, right );
int i = left, j = right - 1;
for ( ; ; ) {
while ( arr[ ++i ].compareTo( pivot ) < 0 ) ;
while ( arr[ --j ].compareTo( pivot ) > 0 ) ;
if ( i < j )
swapReferences( arr, i, j );
else
break;
}
swapReferences( arr, i, right - 1 );
if ( k <= i )
quickSelect( arr, left, i - 1, k );
else if ( k > i + 1 )
quickSelect( arr, i + 1, right, k );
} else {
insertionSort( arr, left, right );
}
} | [
"private",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"quickSelect",
"(",
"T",
"[",
"]",
"arr",
",",
"int",
"left",
",",
"int",
"right",
",",
"int",
"k",
")",
"{",
"if",
"(",
"left",
"+",
"CUTOFF",
"<=",
"right",
")",
"{",
"T",
"pivot",
"=",
"median",
"(",
"arr",
",",
"left",
",",
"right",
")",
";",
"int",
"i",
"=",
"left",
",",
"j",
"=",
"right",
"-",
"1",
";",
"for",
"(",
";",
";",
")",
"{",
"while",
"(",
"arr",
"[",
"++",
"i",
"]",
".",
"compareTo",
"(",
"pivot",
")",
"<",
"0",
")",
";",
"while",
"(",
"arr",
"[",
"--",
"j",
"]",
".",
"compareTo",
"(",
"pivot",
")",
">",
"0",
")",
";",
"if",
"(",
"i",
"<",
"j",
")",
"swapReferences",
"(",
"arr",
",",
"i",
",",
"j",
")",
";",
"else",
"break",
";",
"}",
"swapReferences",
"(",
"arr",
",",
"i",
",",
"right",
"-",
"1",
")",
";",
"if",
"(",
"k",
"<=",
"i",
")",
"quickSelect",
"(",
"arr",
",",
"left",
",",
"i",
"-",
"1",
",",
"k",
")",
";",
"else",
"if",
"(",
"k",
">",
"i",
"+",
"1",
")",
"quickSelect",
"(",
"arr",
",",
"i",
"+",
"1",
",",
"right",
",",
"k",
")",
";",
"}",
"else",
"{",
"insertionSort",
"(",
"arr",
",",
"left",
",",
"right",
")",
";",
"}",
"}"
] | internal method to find the Kth small element for the given array | [
"internal",
"method",
"to",
"find",
"the",
"Kth",
"small",
"element",
"for",
"the",
"given",
"array"
] | [
"//find the pivot",
"//swap the pivot"
] | [
{
"param": "arr",
"type": "T[]"
},
{
"param": "left",
"type": "int"
},
{
"param": "right",
"type": "int"
},
{
"param": "k",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arr",
"type": "T[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "left",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "right",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "k",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
760,
411,
56,
3231,
13633,
12880,
2240,
399,
9778,
7010,
565,
918,
9549,
3391,
12,
399,
8526,
2454,
16,
509,
2002,
16,
509,
2145,
16,
509,
417,
262,
203,
565,
288,
203,
3639,
309,
261,
2002,
397,
385,
1693,
8797,
1648,
2145,
262,
288,
203,
5411,
368,
4720,
326,
9939,
203,
5411,
399,
9939,
273,
12644,
12,
2454,
16,
2002,
16,
2145,
11272,
203,
2398,
203,
5411,
509,
277,
273,
2002,
16,
525,
273,
2145,
300,
404,
31,
203,
5411,
364,
261,
274,
274,
262,
288,
203,
7734,
1323,
261,
2454,
63,
965,
77,
308,
18,
9877,
774,
12,
9939,
262,
411,
374,
262,
274,
203,
7734,
1323,
261,
2454,
63,
1493,
78,
308,
18,
9877,
774,
12,
9939,
262,
405,
374,
262,
274,
203,
7734,
309,
261,
277,
411,
525,
262,
203,
10792,
7720,
8221,
12,
2454,
16,
277,
16,
525,
11272,
203,
7734,
469,
7010,
10792,
898,
31,
203,
5411,
289,
203,
2398,
203,
5411,
368,
22270,
326,
9939,
203,
5411,
7720,
8221,
12,
2454,
16,
277,
16,
2145,
300,
404,
11272,
203,
2398,
203,
5411,
309,
261,
417,
1648,
277,
262,
203,
7734,
9549,
3391,
12,
2454,
16,
2002,
16,
277,
300,
404,
16,
417,
11272,
203,
5411,
469,
309,
261,
417,
405,
277,
397,
404,
262,
203,
7734,
9549,
3391,
12,
2454,
16,
277,
397,
404,
16,
2145,
16,
417,
11272,
203,
2398,
203,
3639,
289,
469,
288,
203,
5411,
12626,
4416,
12,
2454,
16,
2002,
16,
2145,
11272,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2713,
707,
358,
1104,
326,
1475,
451,
5264,
930,
364,
326,
864,
526,
203,
377,
380,
7010,
377,
380,
632,
891,
2454,
392,
526,
434,
13633,
1516,
203,
377,
380,
632,
891,
2002,
326,
2002,
17,
10329,
770,
434,
326,
720,
1126,
203,
377,
380,
632,
891,
2145,
326,
2145,
17,
10329,
770,
434,
326,
720,
1126,
203,
377,
380,
632,
891,
417,
326,
417,
17,
451,
5264,
930,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
82a1e5eaea4f57495b0360b164c4f9a28840b270 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java | [
"Apache-2.0"
] | Java | bucketSort | null | public static void bucketSort( int[] arr, int m )
{
int[] count = new int[m];
int j, i = 0;
//System.out.println(count[0]==0?"true":"false");
for ( j = 0; j < arr.length; j++ ) {
count[ arr[j] ]++;
}
//loop and filter the elements
for ( j = 0; j < m; j++ ) {
if ( count[j] > 0 ) {
while ( count[j]-- > 0 ) {
arr[i++] = j;
}
}
}
} | /**
* bucket sort algorithm
*
* @param arr an int array
* @param m the large-most one for all the Integers in arr
*/ | bucket sort algorithm
@param arr an int array
@param m the large-most one for all the Integers in arr | [
"bucket",
"sort",
"algorithm",
"@param",
"arr",
"an",
"int",
"array",
"@param",
"m",
"the",
"large",
"-",
"most",
"one",
"for",
"all",
"the",
"Integers",
"in",
"arr"
] | public static void bucketSort( int[] arr, int m )
{
int[] count = new int[m];
int j, i = 0;
for ( j = 0; j < arr.length; j++ ) {
count[ arr[j] ]++;
}
for ( j = 0; j < m; j++ ) {
if ( count[j] > 0 ) {
while ( count[j]-- > 0 ) {
arr[i++] = j;
}
}
}
} | [
"public",
"static",
"void",
"bucketSort",
"(",
"int",
"[",
"]",
"arr",
",",
"int",
"m",
")",
"{",
"int",
"[",
"]",
"count",
"=",
"new",
"int",
"[",
"m",
"]",
";",
"int",
"j",
",",
"i",
"=",
"0",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"arr",
".",
"length",
";",
"j",
"++",
")",
"{",
"count",
"[",
"arr",
"[",
"j",
"]",
"]",
"++",
";",
"}",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"m",
";",
"j",
"++",
")",
"{",
"if",
"(",
"count",
"[",
"j",
"]",
">",
"0",
")",
"{",
"while",
"(",
"count",
"[",
"j",
"]",
"--",
">",
"0",
")",
"{",
"arr",
"[",
"i",
"++",
"]",
"=",
"j",
";",
"}",
"}",
"}",
"}"
] | bucket sort algorithm | [
"bucket",
"sort",
"algorithm"
] | [
"//System.out.println(count[0]==0?\"true\":\"false\");",
"//loop and filter the elements"
] | [
{
"param": "arr",
"type": "int[]"
},
{
"param": "m",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arr",
"type": "int[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "m",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
918,
2783,
4416,
12,
509,
8526,
2454,
16,
509,
312,
262,
203,
565,
288,
203,
3639,
509,
8526,
1056,
273,
394,
509,
63,
81,
15533,
203,
3639,
509,
525,
16,
277,
273,
374,
31,
203,
3639,
368,
3163,
18,
659,
18,
8222,
12,
1883,
63,
20,
65,
631,
20,
7225,
3767,
15563,
5743,
8863,
203,
3639,
364,
261,
525,
273,
374,
31,
525,
411,
2454,
18,
2469,
31,
525,
9904,
262,
288,
203,
5411,
1056,
63,
2454,
63,
78,
65,
308,
9904,
31,
203,
3639,
289,
203,
540,
203,
3639,
368,
6498,
471,
1034,
326,
2186,
203,
3639,
364,
261,
525,
273,
374,
31,
525,
411,
312,
31,
525,
9904,
262,
288,
203,
5411,
309,
261,
1056,
63,
78,
65,
405,
374,
262,
288,
203,
7734,
1323,
261,
1056,
63,
78,
65,
413,
405,
374,
262,
288,
203,
10792,
2454,
63,
77,
9904,
65,
273,
525,
31,
203,
7734,
289,
203,
5411,
289,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2783,
1524,
4886,
203,
377,
380,
7010,
377,
380,
632,
891,
2454,
392,
509,
526,
203,
377,
380,
632,
891,
312,
326,
7876,
17,
10329,
1245,
364,
777,
326,
657,
736,
6215,
316,
2454,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
82a1e5eaea4f57495b0360b164c4f9a28840b270 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java | [
"Apache-2.0"
] | Java | bucketSort | null | public static void bucketSort( Integer[] arr, int m )
{
int[] count = new int[m];
int j, i = 0;
for ( j = 0; j < arr.length; j++ ) {
count[ arr[j] ]++;
}
//loop and filter the elements
for ( j = 0; j < m; j++ ) {
if ( count[j] > 0 ) {
while ( count[j]-- > 0 ) {
arr[i++] = i;
}
}
}
} | /**
* bucket sort algorithm
*
* @param arr an array of Integer items
* @param m the large-most one for all the Integers in arr
*/ | bucket sort algorithm
@param arr an array of Integer items
@param m the large-most one for all the Integers in arr | [
"bucket",
"sort",
"algorithm",
"@param",
"arr",
"an",
"array",
"of",
"Integer",
"items",
"@param",
"m",
"the",
"large",
"-",
"most",
"one",
"for",
"all",
"the",
"Integers",
"in",
"arr"
] | public static void bucketSort( Integer[] arr, int m )
{
int[] count = new int[m];
int j, i = 0;
for ( j = 0; j < arr.length; j++ ) {
count[ arr[j] ]++;
}
for ( j = 0; j < m; j++ ) {
if ( count[j] > 0 ) {
while ( count[j]-- > 0 ) {
arr[i++] = i;
}
}
}
} | [
"public",
"static",
"void",
"bucketSort",
"(",
"Integer",
"[",
"]",
"arr",
",",
"int",
"m",
")",
"{",
"int",
"[",
"]",
"count",
"=",
"new",
"int",
"[",
"m",
"]",
";",
"int",
"j",
",",
"i",
"=",
"0",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"arr",
".",
"length",
";",
"j",
"++",
")",
"{",
"count",
"[",
"arr",
"[",
"j",
"]",
"]",
"++",
";",
"}",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"m",
";",
"j",
"++",
")",
"{",
"if",
"(",
"count",
"[",
"j",
"]",
">",
"0",
")",
"{",
"while",
"(",
"count",
"[",
"j",
"]",
"--",
">",
"0",
")",
"{",
"arr",
"[",
"i",
"++",
"]",
"=",
"i",
";",
"}",
"}",
"}",
"}"
] | bucket sort algorithm | [
"bucket",
"sort",
"algorithm"
] | [
"//loop and filter the elements"
] | [
{
"param": "arr",
"type": "Integer[]"
},
{
"param": "m",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arr",
"type": "Integer[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "m",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
918,
2783,
4416,
12,
2144,
8526,
2454,
16,
509,
312,
262,
203,
565,
288,
203,
3639,
509,
8526,
1056,
273,
394,
509,
63,
81,
15533,
203,
3639,
509,
525,
16,
277,
273,
374,
31,
203,
3639,
364,
261,
525,
273,
374,
31,
525,
411,
2454,
18,
2469,
31,
525,
9904,
262,
225,
288,
203,
5411,
1056,
63,
2454,
63,
78,
65,
308,
9904,
31,
203,
3639,
289,
203,
540,
203,
3639,
368,
6498,
471,
1034,
326,
2186,
203,
3639,
364,
261,
525,
273,
374,
31,
525,
411,
312,
31,
525,
9904,
262,
288,
203,
5411,
309,
261,
1056,
63,
78,
65,
405,
374,
262,
288,
203,
7734,
1323,
261,
1056,
63,
78,
65,
413,
405,
374,
262,
288,
203,
10792,
2454,
63,
77,
9904,
65,
273,
277,
31,
203,
7734,
289,
203,
5411,
289,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0
] | [
1,
26873,
203,
377,
380,
2783,
1524,
4886,
203,
377,
380,
7010,
377,
380,
632,
891,
2454,
392,
526,
434,
2144,
1516,
203,
377,
380,
632,
891,
312,
326,
7876,
17,
10329,
1245,
364,
777,
326,
657,
736,
6215,
316,
2454,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
db776ac7887e17e2c8f282d99e1605b6b2be085b | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/segmenter/SegKit.java | [
"Apache-2.0"
] | Java | appendSynonyms | null | public final static void appendSynonyms(SegmenterConfig config, LinkedList<IWord> wordPool, IWord wd)
{
final List<IWord> synList = wd.getSyn().getList();
synchronized (synList) {
for ( int j = 0; j < synList.size(); j++ ) {
final IWord curWord = synList.get(j);
if ( curWord.getValue()
.equals(wd.getValue()) ) {
continue;
}
final IWord synWord = synList.get(j).clone();
synWord.setPosition(wd.getPosition());
synWord.setLength(wd.getLength()); /* Force the length equals to the root word's */
wordPool.add(synWord);
// check and append its Pinyin
if ( config.APPEND_CJK_PINYIN
&& config.LOAD_CJK_PINYIN && synWord.getPinyin() != null ) {
appendPinyin(config, wordPool, synWord);
}
}
}
} | /**
* quick interface to do the synonyms word append
* You got check if the specified word has any synonyms first
*
* @param config
* @param wordPool
* @param wd
*/ | quick interface to do the synonyms word append
You got check if the specified word has any synonyms first
| [
"quick",
"interface",
"to",
"do",
"the",
"synonyms",
"word",
"append",
"You",
"got",
"check",
"if",
"the",
"specified",
"word",
"has",
"any",
"synonyms",
"first"
] | public final static void appendSynonyms(SegmenterConfig config, LinkedList<IWord> wordPool, IWord wd)
{
final List<IWord> synList = wd.getSyn().getList();
synchronized (synList) {
for ( int j = 0; j < synList.size(); j++ ) {
final IWord curWord = synList.get(j);
if ( curWord.getValue()
.equals(wd.getValue()) ) {
continue;
}
final IWord synWord = synList.get(j).clone();
synWord.setPosition(wd.getPosition());
synWord.setLength(wd.getLength()); /* Force the length equals to the root word's */
wordPool.add(synWord);
if ( config.APPEND_CJK_PINYIN
&& config.LOAD_CJK_PINYIN && synWord.getPinyin() != null ) {
appendPinyin(config, wordPool, synWord);
}
}
}
} | [
"public",
"final",
"static",
"void",
"appendSynonyms",
"(",
"SegmenterConfig",
"config",
",",
"LinkedList",
"<",
"IWord",
">",
"wordPool",
",",
"IWord",
"wd",
")",
"{",
"final",
"List",
"<",
"IWord",
">",
"synList",
"=",
"wd",
".",
"getSyn",
"(",
")",
".",
"getList",
"(",
")",
";",
"synchronized",
"(",
"synList",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"synList",
".",
"size",
"(",
")",
";",
"j",
"++",
")",
"{",
"final",
"IWord",
"curWord",
"=",
"synList",
".",
"get",
"(",
"j",
")",
";",
"if",
"(",
"curWord",
".",
"getValue",
"(",
")",
".",
"equals",
"(",
"wd",
".",
"getValue",
"(",
")",
")",
")",
"{",
"continue",
";",
"}",
"final",
"IWord",
"synWord",
"=",
"synList",
".",
"get",
"(",
"j",
")",
".",
"clone",
"(",
")",
";",
"synWord",
".",
"setPosition",
"(",
"wd",
".",
"getPosition",
"(",
")",
")",
";",
"synWord",
".",
"setLength",
"(",
"wd",
".",
"getLength",
"(",
")",
")",
";",
"/* Force the length equals to the root word's */",
"wordPool",
".",
"add",
"(",
"synWord",
")",
";",
"if",
"(",
"config",
".",
"APPEND_CJK_PINYIN",
"&&",
"config",
".",
"LOAD_CJK_PINYIN",
"&&",
"synWord",
".",
"getPinyin",
"(",
")",
"!=",
"null",
")",
"{",
"appendPinyin",
"(",
"config",
",",
"wordPool",
",",
"synWord",
")",
";",
"}",
"}",
"}",
"}"
] | quick interface to do the synonyms word append
You got check if the specified word has any synonyms first | [
"quick",
"interface",
"to",
"do",
"the",
"synonyms",
"word",
"append",
"You",
"got",
"check",
"if",
"the",
"specified",
"word",
"has",
"any",
"synonyms",
"first"
] | [
"// check and append its Pinyin"
] | [
{
"param": "config",
"type": "SegmenterConfig"
},
{
"param": "wordPool",
"type": "LinkedList<IWord>"
},
{
"param": "wd",
"type": "IWord"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": "SegmenterConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wordPool",
"type": "LinkedList<IWord>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wd",
"type": "IWord",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
727,
760,
918,
714,
10503,
16968,
12,
4131,
264,
809,
642,
16,
10688,
32,
45,
3944,
34,
2076,
2864,
16,
467,
3944,
14452,
13,
203,
565,
288,
203,
3639,
727,
987,
32,
45,
3944,
34,
6194,
682,
273,
14452,
18,
588,
10503,
7675,
588,
682,
5621,
203,
3639,
3852,
261,
11982,
682,
13,
288,
203,
5411,
364,
261,
509,
525,
273,
374,
31,
525,
411,
6194,
682,
18,
1467,
5621,
525,
9904,
262,
288,
203,
2398,
202,
6385,
467,
3944,
662,
3944,
273,
6194,
682,
18,
588,
12,
78,
1769,
203,
7734,
309,
261,
662,
3944,
18,
24805,
1435,
203,
13491,
263,
14963,
12,
3623,
18,
24805,
10756,
262,
288,
203,
10792,
1324,
31,
203,
7734,
289,
203,
1171,
203,
7734,
727,
467,
3944,
6194,
3944,
273,
6194,
682,
18,
588,
12,
78,
2934,
14056,
5621,
203,
7734,
6194,
3944,
18,
542,
2555,
12,
3623,
18,
588,
2555,
10663,
203,
7734,
6194,
3944,
18,
542,
1782,
12,
3623,
18,
588,
1782,
10663,
202,
20308,
11889,
326,
769,
1606,
358,
326,
1365,
2076,
1807,
1195,
203,
7734,
2076,
2864,
18,
1289,
12,
11982,
3944,
1769,
203,
1171,
203,
7734,
368,
866,
471,
714,
2097,
453,
11652,
267,
203,
7734,
309,
261,
642,
18,
24176,
67,
39,
19474,
67,
52,
31853,
706,
7010,
13491,
597,
642,
18,
7783,
67,
39,
19474,
67,
52,
31853,
706,
597,
6194,
3944,
18,
588,
52,
11652,
267,
1435,
480,
446,
262,
288,
203,
1171,
202,
6923,
52,
11652,
267,
12,
1425,
16,
2076,
2864,
16,
6194,
3944,
1769,
203,
7734,
289,
203,
5411,
289,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
9549,
1560,
358,
741,
326,
27260,
2076,
714,
203,
377,
380,
4554,
2363,
866,
309,
326,
1269,
2076,
711,
1281,
27260,
1122,
203,
377,
380,
7010,
377,
380,
632,
891,
202,
1425,
203,
377,
380,
632,
891,
282,
2076,
2864,
203,
377,
380,
632,
891,
282,
14452,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
db776ac7887e17e2c8f282d99e1605b6b2be085b | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/segmenter/SegKit.java | [
"Apache-2.0"
] | Java | appendPinyin | null | public final static void appendPinyin(SegmenterConfig config, LinkedList<IWord> wordPool, IWord wd)
{
/*
* For search, you know this is a complex topic for pinyin process
* You may add your logic for processing the Pinyin for search here.
* By default we just merge them and take it as single word item.
*/
final String pinyin = wd.getPinyin().replaceAll("\\s+", "");
final IWord pyWord = new Word(pinyin, IWord.T_CJK_PINYIN);
pyWord.setPosition(wd.getPosition());
pyWord.setLength(wd.getLength());
pyWord.setEntity(wd.getEntity());
pyWord.setPartSpeech(wd.getPartSpeech());
wordPool.add(pyWord);
} | /**
* Quick interface to do the pinyin word append.
* You got to check if the specified word has the pinyin attribute
*
* @param config
* @param wordPool
* @param wd
*/ | Quick interface to do the pinyin word append.
You got to check if the specified word has the pinyin attribute
| [
"Quick",
"interface",
"to",
"do",
"the",
"pinyin",
"word",
"append",
".",
"You",
"got",
"to",
"check",
"if",
"the",
"specified",
"word",
"has",
"the",
"pinyin",
"attribute"
] | public final static void appendPinyin(SegmenterConfig config, LinkedList<IWord> wordPool, IWord wd)
{
/*
* For search, you know this is a complex topic for pinyin process
* You may add your logic for processing the Pinyin for search here.
* By default we just merge them and take it as single word item.
*/
final String pinyin = wd.getPinyin().replaceAll("\\s+", "");
final IWord pyWord = new Word(pinyin, IWord.T_CJK_PINYIN);
pyWord.setPosition(wd.getPosition());
pyWord.setLength(wd.getLength());
pyWord.setEntity(wd.getEntity());
pyWord.setPartSpeech(wd.getPartSpeech());
wordPool.add(pyWord);
} | [
"public",
"final",
"static",
"void",
"appendPinyin",
"(",
"SegmenterConfig",
"config",
",",
"LinkedList",
"<",
"IWord",
">",
"wordPool",
",",
"IWord",
"wd",
")",
"{",
"/* \n \t * For search, you know this is a complex topic for pinyin process \n \t * You may add your logic for processing the Pinyin for search here.\n \t * By default we just merge them and take it as single word item. \n \t*/",
"final",
"String",
"pinyin",
"=",
"wd",
".",
"getPinyin",
"(",
")",
".",
"replaceAll",
"(",
"\"\\\\s+\"",
",",
"\"\"",
")",
";",
"final",
"IWord",
"pyWord",
"=",
"new",
"Word",
"(",
"pinyin",
",",
"IWord",
".",
"T_CJK_PINYIN",
")",
";",
"pyWord",
".",
"setPosition",
"(",
"wd",
".",
"getPosition",
"(",
")",
")",
";",
"pyWord",
".",
"setLength",
"(",
"wd",
".",
"getLength",
"(",
")",
")",
";",
"pyWord",
".",
"setEntity",
"(",
"wd",
".",
"getEntity",
"(",
")",
")",
";",
"pyWord",
".",
"setPartSpeech",
"(",
"wd",
".",
"getPartSpeech",
"(",
")",
")",
";",
"wordPool",
".",
"add",
"(",
"pyWord",
")",
";",
"}"
] | Quick interface to do the pinyin word append. | [
"Quick",
"interface",
"to",
"do",
"the",
"pinyin",
"word",
"append",
"."
] | [] | [
{
"param": "config",
"type": "SegmenterConfig"
},
{
"param": "wordPool",
"type": "LinkedList<IWord>"
},
{
"param": "wd",
"type": "IWord"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": "SegmenterConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wordPool",
"type": "LinkedList<IWord>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wd",
"type": "IWord",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
727,
760,
918,
714,
52,
11652,
267,
12,
4131,
264,
809,
642,
16,
10688,
32,
45,
3944,
34,
2076,
2864,
16,
467,
3944,
14452,
13,
203,
565,
288,
203,
377,
202,
20308,
7010,
377,
202,
380,
2457,
1623,
16,
1846,
5055,
333,
353,
279,
7233,
3958,
364,
7092,
93,
267,
1207,
7010,
377,
202,
380,
4554,
2026,
527,
3433,
4058,
364,
4929,
326,
453,
11652,
267,
364,
1623,
2674,
18,
203,
377,
202,
380,
2525,
805,
732,
2537,
2691,
2182,
471,
4862,
518,
487,
2202,
2076,
761,
18,
7010,
377,
202,
5549,
203,
377,
202,
6385,
514,
7092,
93,
267,
273,
14452,
18,
588,
52,
11652,
267,
7675,
2079,
1595,
2932,
1695,
87,
15,
3113,
1408,
1769,
203,
3639,
727,
467,
3944,
2395,
3944,
273,
394,
9926,
12,
84,
11652,
267,
16,
467,
3944,
18,
56,
67,
39,
19474,
67,
52,
31853,
706,
1769,
203,
3639,
2395,
3944,
18,
542,
2555,
12,
3623,
18,
588,
2555,
10663,
203,
3639,
2395,
3944,
18,
542,
1782,
12,
3623,
18,
588,
1782,
10663,
203,
3639,
2395,
3944,
18,
542,
1943,
12,
3623,
18,
588,
1943,
10663,
203,
3639,
2395,
3944,
18,
542,
1988,
22334,
12,
3623,
18,
588,
1988,
22334,
10663,
203,
3639,
2076,
2864,
18,
1289,
12,
2074,
3944,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
358,
741,
326,
7092,
93,
267,
2076,
714,
18,
203,
377,
380,
4554,
2363,
358,
866,
309,
326,
1269,
2076,
711,
326,
7092,
93,
267,
1566,
203,
377,
380,
7010,
377,
380,
632,
891,
202,
1425,
203,
377,
380,
632,
891,
202,
1095,
2864,
203,
377,
380,
632,
891,
202,
3623,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
e208f372e89cdd2069da9b03c34fd9dde10f7a58 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/segmenter/NGramSeg.java | [
"Apache-2.0"
] | Java | streamResetTo | null | protected void streamResetTo(String str, int start) throws IOException
{
for ( int i = start; i < str.length(); i++ ) {
pushBack(str.charAt(i));
}
} | /** reset the data back from the specified position
* @throws IOException */ | reset the data back from the specified position
@throws IOException | [
"reset",
"the",
"data",
"back",
"from",
"the",
"specified",
"position",
"@throws",
"IOException"
] | protected void streamResetTo(String str, int start) throws IOException
{
for ( int i = start; i < str.length(); i++ ) {
pushBack(str.charAt(i));
}
} | [
"protected",
"void",
"streamResetTo",
"(",
"String",
"str",
",",
"int",
"start",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"str",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"pushBack",
"(",
"str",
".",
"charAt",
"(",
"i",
")",
")",
";",
"}",
"}"
] | reset the data back from the specified position
@throws IOException | [
"reset",
"the",
"data",
"back",
"from",
"the",
"specified",
"position",
"@throws",
"IOException"
] | [] | [
{
"param": "str",
"type": "String"
},
{
"param": "start",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "start",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
1407,
7013,
774,
12,
780,
609,
16,
509,
787,
13,
1216,
1860,
203,
565,
288,
203,
202,
202,
1884,
261,
509,
277,
273,
787,
31,
277,
411,
609,
18,
2469,
5621,
277,
9904,
262,
288,
203,
1082,
202,
6206,
2711,
12,
701,
18,
3001,
861,
12,
77,
10019,
203,
202,
202,
97,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
2715,
326,
501,
1473,
628,
326,
1269,
1754,
7010,
377,
380,
632,
15069,
1860,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
b6f4ab110a1a5a373b3451307b1b681d3fd30c2d | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/dic/ADictionary.java | [
"Apache-2.0"
] | Java | load | null | public void load( File file )
throws NumberFormatException, FileNotFoundException, IOException
{
loadWords(config, this, file, synBuffer);
} | /**
* load all the words from a specified lexicon file
*
* @param file
* @throws IOException
* @throws FileNotFoundException
* @throws NumberFormatException
*/ | load all the words from a specified lexicon file
| [
"load",
"all",
"the",
"words",
"from",
"a",
"specified",
"lexicon",
"file"
] | public void load( File file )
throws NumberFormatException, FileNotFoundException, IOException
{
loadWords(config, this, file, synBuffer);
} | [
"public",
"void",
"load",
"(",
"File",
"file",
")",
"throws",
"NumberFormatException",
",",
"FileNotFoundException",
",",
"IOException",
"{",
"loadWords",
"(",
"config",
",",
"this",
",",
"file",
",",
"synBuffer",
")",
";",
"}"
] | load all the words from a specified lexicon file | [
"load",
"all",
"the",
"words",
"from",
"a",
"specified",
"lexicon",
"file"
] | [] | [
{
"param": "file",
"type": "File"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
1262,
12,
1387,
585,
262,
203,
5411,
1216,
12100,
16,
13707,
16,
1860,
203,
565,
288,
203,
3639,
1262,
7363,
12,
1425,
16,
333,
16,
585,
16,
6194,
1892,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1262,
777,
326,
4511,
628,
279,
1269,
31681,
585,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
585,
203,
377,
380,
632,
15069,
225,
1860,
7010,
377,
380,
632,
15069,
225,
13707,
7010,
377,
380,
632,
15069,
225,
12100,
7010,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
b6f4ab110a1a5a373b3451307b1b681d3fd30c2d | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/dic/ADictionary.java | [
"Apache-2.0"
] | Java | load | null | public void load( String file )
throws NumberFormatException, FileNotFoundException, IOException
{
loadWords(config, this, file, synBuffer);
} | /**
* load all the words from a specified lexicon path
*
* @param file
* @throws IOException
* @throws FileNotFoundException
* @throws NumberFormatException
*/ | load all the words from a specified lexicon path
| [
"load",
"all",
"the",
"words",
"from",
"a",
"specified",
"lexicon",
"path"
] | public void load( String file )
throws NumberFormatException, FileNotFoundException, IOException
{
loadWords(config, this, file, synBuffer);
} | [
"public",
"void",
"load",
"(",
"String",
"file",
")",
"throws",
"NumberFormatException",
",",
"FileNotFoundException",
",",
"IOException",
"{",
"loadWords",
"(",
"config",
",",
"this",
",",
"file",
",",
"synBuffer",
")",
";",
"}"
] | load all the words from a specified lexicon path | [
"load",
"all",
"the",
"words",
"from",
"a",
"specified",
"lexicon",
"path"
] | [] | [
{
"param": "file",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
1262,
12,
514,
585,
262,
7010,
5411,
1216,
12100,
16,
13707,
16,
1860,
203,
565,
288,
203,
3639,
1262,
7363,
12,
1425,
16,
333,
16,
585,
16,
6194,
1892,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1262,
777,
326,
4511,
628,
279,
1269,
31681,
589,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
585,
203,
377,
380,
632,
15069,
225,
1860,
7010,
377,
380,
632,
15069,
225,
13707,
7010,
377,
380,
632,
15069,
225,
12100,
7010,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
b6f4ab110a1a5a373b3451307b1b681d3fd30c2d | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/dic/ADictionary.java | [
"Apache-2.0"
] | Java | loadDirectory | null | public void loadDirectory( String lexDir ) throws IOException
{
File path = new File(lexDir);
if ( ! path.exists() ) {
throw new IOException("Lexicon directory ["+lexDir+"] does'n exists.");
}
/*
* load all the lexicon file under the lexicon path
* that start with "lex-" and end with ".lex".
*/
File[] files = path.listFiles(new FilenameFilter(){
@Override
public boolean accept(File dir, String name) {
return (name.startsWith("lex-") && name.endsWith(".lex"));
}
});
for ( File file : files ) {
load(file);
}
} | /**
* load the all the words from all the files under a specified lexicon directory
*
* @param lexDir
* @throws IOException
*/ | load the all the words from all the files under a specified lexicon directory
@param lexDir
@throws IOException | [
"load",
"the",
"all",
"the",
"words",
"from",
"all",
"the",
"files",
"under",
"a",
"specified",
"lexicon",
"directory",
"@param",
"lexDir",
"@throws",
"IOException"
] | public void loadDirectory( String lexDir ) throws IOException
{
File path = new File(lexDir);
if ( ! path.exists() ) {
throw new IOException("Lexicon directory ["+lexDir+"] does'n exists.");
}
/*
* load all the lexicon file under the lexicon path
* that start with "lex-" and end with ".lex".
*/
File[] files = path.listFiles(new FilenameFilter(){
@Override
public boolean accept(File dir, String name) {
return (name.startsWith("lex-") && name.endsWith(".lex"));
}
});
for ( File file : files ) {
load(file);
}
} | [
"public",
"void",
"loadDirectory",
"(",
"String",
"lexDir",
")",
"throws",
"IOException",
"{",
"File",
"path",
"=",
"new",
"File",
"(",
"lexDir",
")",
";",
"if",
"(",
"!",
"path",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Lexicon directory [\"",
"+",
"lexDir",
"+",
"\"] does'n exists.\"",
")",
";",
"}",
"/*\n * load all the lexicon file under the lexicon path \n * that start with \"lex-\" and end with \".lex\".\n */",
"File",
"[",
"]",
"files",
"=",
"path",
".",
"listFiles",
"(",
"new",
"FilenameFilter",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"File",
"dir",
",",
"String",
"name",
")",
"{",
"return",
"(",
"name",
".",
"startsWith",
"(",
"\"lex-\"",
")",
"&&",
"name",
".",
"endsWith",
"(",
"\".lex\"",
")",
")",
";",
"}",
"}",
")",
";",
"for",
"(",
"File",
"file",
":",
"files",
")",
"{",
"load",
"(",
"file",
")",
";",
"}",
"}"
] | load the all the words from all the files under a specified lexicon directory | [
"load",
"the",
"all",
"the",
"words",
"from",
"all",
"the",
"files",
"under",
"a",
"specified",
"lexicon",
"directory"
] | [] | [
{
"param": "lexDir",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lexDir",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
1262,
2853,
12,
514,
5275,
1621,
262,
1216,
1860,
203,
565,
288,
203,
3639,
1387,
589,
273,
394,
1387,
12,
4149,
1621,
1769,
203,
3639,
309,
261,
401,
589,
18,
1808,
1435,
262,
288,
203,
5411,
604,
394,
1860,
2932,
21743,
1867,
8247,
15,
4149,
1621,
9078,
65,
1552,
11,
82,
1704,
1199,
1769,
203,
3639,
289,
203,
540,
203,
3639,
1748,
203,
540,
380,
1262,
777,
326,
31681,
585,
3613,
326,
31681,
589,
7010,
540,
380,
377,
716,
787,
598,
315,
4149,
10951,
471,
679,
598,
3552,
4149,
9654,
203,
540,
1195,
203,
3639,
1387,
8526,
1390,
273,
589,
18,
1098,
2697,
12,
2704,
16671,
1586,
1435,
95,
203,
5411,
632,
6618,
203,
5411,
1071,
1250,
2791,
12,
812,
1577,
16,
514,
508,
13,
288,
203,
7734,
327,
261,
529,
18,
17514,
1190,
2932,
4149,
17,
7923,
597,
508,
18,
5839,
1190,
2932,
18,
4149,
7923,
1769,
203,
5411,
289,
203,
3639,
15549,
203,
540,
203,
3639,
364,
261,
1387,
585,
294,
1390,
262,
288,
203,
5411,
1262,
12,
768,
1769,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1262,
326,
777,
326,
4511,
628,
777,
326,
1390,
3613,
279,
1269,
31681,
1867,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
5275,
1621,
203,
377,
380,
632,
15069,
225,
1860,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
b6f4ab110a1a5a373b3451307b1b681d3fd30c2d | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/dic/ADictionary.java | [
"Apache-2.0"
] | Java | loadClassPath | null | public void loadClassPath() throws IOException
{
Class<?> dClass = this.getClass();
CodeSource codeSrc = this.getClass().getProtectionDomain().getCodeSource();
if ( codeSrc == null ) {
return;
}
String codePath = codeSrc.getLocation().getPath();
if ( codePath.toLowerCase().endsWith(".jar") ) {
ZipInputStream zip = new ZipInputStream(codeSrc.getLocation().openStream());
while ( true ) {
ZipEntry e = zip.getNextEntry();
if ( e == null ) {
break;
}
String fileName = e.getName();
if ( fileName.endsWith(".lex")
&& fileName.startsWith("lexicon/lex-") ) {
load(dClass.getResourceAsStream("/"+fileName));
}
}
} else {
//now, the classpath is an IDE directory
// like eclipse ./bin or maven ./target/classes/
File lexiconDir = new File(URLDecoder.decode(codeSrc.getLocation().getFile(),"utf-8"));
loadDirectory(lexiconDir.getPath() + File.separator + "lexicon");
}
} | /**
* load all the words from all the files under the specified class path.
*
* added at 2016/07/12:
* only in the jar file could the ZipInputStream available
* add IDE classpath supported here
*
* @since 1.9.9
* @throws IOException
*/ | load all the words from all the files under the specified class path.
added at 2016/07/12:
only in the jar file could the ZipInputStream available
add IDE classpath supported here
| [
"load",
"all",
"the",
"words",
"from",
"all",
"the",
"files",
"under",
"the",
"specified",
"class",
"path",
".",
"added",
"at",
"2016",
"/",
"07",
"/",
"12",
":",
"only",
"in",
"the",
"jar",
"file",
"could",
"the",
"ZipInputStream",
"available",
"add",
"IDE",
"classpath",
"supported",
"here"
] | public void loadClassPath() throws IOException
{
Class<?> dClass = this.getClass();
CodeSource codeSrc = this.getClass().getProtectionDomain().getCodeSource();
if ( codeSrc == null ) {
return;
}
String codePath = codeSrc.getLocation().getPath();
if ( codePath.toLowerCase().endsWith(".jar") ) {
ZipInputStream zip = new ZipInputStream(codeSrc.getLocation().openStream());
while ( true ) {
ZipEntry e = zip.getNextEntry();
if ( e == null ) {
break;
}
String fileName = e.getName();
if ( fileName.endsWith(".lex")
&& fileName.startsWith("lexicon/lex-") ) {
load(dClass.getResourceAsStream("/"+fileName));
}
}
} else {
File lexiconDir = new File(URLDecoder.decode(codeSrc.getLocation().getFile(),"utf-8"));
loadDirectory(lexiconDir.getPath() + File.separator + "lexicon");
}
} | [
"public",
"void",
"loadClassPath",
"(",
")",
"throws",
"IOException",
"{",
"Class",
"<",
"?",
">",
"dClass",
"=",
"this",
".",
"getClass",
"(",
")",
";",
"CodeSource",
"codeSrc",
"=",
"this",
".",
"getClass",
"(",
")",
".",
"getProtectionDomain",
"(",
")",
".",
"getCodeSource",
"(",
")",
";",
"if",
"(",
"codeSrc",
"==",
"null",
")",
"{",
"return",
";",
"}",
"String",
"codePath",
"=",
"codeSrc",
".",
"getLocation",
"(",
")",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"codePath",
".",
"toLowerCase",
"(",
")",
".",
"endsWith",
"(",
"\".jar\"",
")",
")",
"{",
"ZipInputStream",
"zip",
"=",
"new",
"ZipInputStream",
"(",
"codeSrc",
".",
"getLocation",
"(",
")",
".",
"openStream",
"(",
")",
")",
";",
"while",
"(",
"true",
")",
"{",
"ZipEntry",
"e",
"=",
"zip",
".",
"getNextEntry",
"(",
")",
";",
"if",
"(",
"e",
"==",
"null",
")",
"{",
"break",
";",
"}",
"String",
"fileName",
"=",
"e",
".",
"getName",
"(",
")",
";",
"if",
"(",
"fileName",
".",
"endsWith",
"(",
"\".lex\"",
")",
"&&",
"fileName",
".",
"startsWith",
"(",
"\"lexicon/lex-\"",
")",
")",
"{",
"load",
"(",
"dClass",
".",
"getResourceAsStream",
"(",
"\"/\"",
"+",
"fileName",
")",
")",
";",
"}",
"}",
"}",
"else",
"{",
"File",
"lexiconDir",
"=",
"new",
"File",
"(",
"URLDecoder",
".",
"decode",
"(",
"codeSrc",
".",
"getLocation",
"(",
")",
".",
"getFile",
"(",
")",
",",
"\"utf-8\"",
")",
")",
";",
"loadDirectory",
"(",
"lexiconDir",
".",
"getPath",
"(",
")",
"+",
"File",
".",
"separator",
"+",
"\"lexicon\"",
")",
";",
"}",
"}"
] | load all the words from all the files under the specified class path. | [
"load",
"all",
"the",
"words",
"from",
"all",
"the",
"files",
"under",
"the",
"specified",
"class",
"path",
"."
] | [
"//now, the classpath is an IDE directory ",
"// like eclipse ./bin or maven ./target/classes/"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
16038,
743,
1435,
1216,
1860,
203,
565,
288,
203,
3639,
1659,
12880,
34,
302,
797,
565,
273,
333,
18,
588,
797,
5621,
203,
3639,
3356,
1830,
981,
7740,
273,
333,
18,
588,
797,
7675,
588,
16938,
3748,
7675,
588,
1085,
1830,
5621,
203,
3639,
309,
261,
981,
7740,
422,
446,
262,
288,
203,
5411,
327,
31,
203,
3639,
289,
203,
540,
203,
3639,
514,
981,
743,
273,
981,
7740,
18,
588,
2735,
7675,
588,
743,
5621,
203,
3639,
309,
261,
981,
743,
18,
869,
5630,
7675,
5839,
1190,
2932,
18,
11930,
7923,
262,
288,
203,
5411,
8603,
4348,
3144,
273,
394,
8603,
4348,
12,
710,
7740,
18,
588,
2735,
7675,
3190,
1228,
10663,
203,
5411,
1323,
261,
638,
262,
288,
203,
7734,
23652,
425,
273,
3144,
18,
588,
2134,
1622,
5621,
203,
7734,
309,
261,
425,
422,
446,
262,
288,
203,
10792,
898,
31,
203,
7734,
289,
203,
1171,
203,
7734,
514,
3968,
273,
425,
18,
17994,
5621,
203,
7734,
309,
261,
3968,
18,
5839,
1190,
2932,
18,
4149,
7923,
7010,
13491,
597,
3968,
18,
17514,
1190,
2932,
4149,
3950,
19,
4149,
17,
7923,
262,
288,
203,
10792,
1262,
12,
72,
797,
18,
588,
1420,
17052,
2932,
4898,
15,
17812,
10019,
203,
7734,
289,
203,
5411,
289,
203,
3639,
289,
469,
288,
203,
5411,
368,
3338,
16,
326,
10006,
353,
392,
1599,
41,
1867,
7010,
5411,
368,
225,
3007,
6557,
10472,
263,
19,
4757,
578,
20499,
263,
19,
3299,
19,
4701,
19,
203,
5411,
1387,
31681,
1621,
273,
394,
1387,
12,
1785,
7975,
18,
3922,
12,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1262,
777,
326,
4511,
628,
777,
326,
1390,
3613,
326,
1269,
667,
589,
18,
203,
377,
380,
7010,
377,
380,
3096,
622,
12659,
19,
8642,
19,
2138,
30,
203,
377,
380,
1338,
316,
326,
7334,
585,
3377,
326,
8603,
4348,
2319,
203,
377,
380,
527,
1599,
41,
10006,
3260,
2674,
203,
377,
380,
203,
377,
380,
632,
9256,
282,
404,
18,
29,
18,
29,
203,
377,
380,
632,
15069,
225,
1860,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
b6f4ab110a1a5a373b3451307b1b681d3fd30c2d | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/dic/ADictionary.java | [
"Apache-2.0"
] | Java | resetSynonymsNet | null | public void resetSynonymsNet()
{
synchronized (synBuffer) {
if ( synBuffer.size() == 0 ) {
return;
}
Iterator<String[]> it = synBuffer.iterator();
while ( it.hasNext() ) {
String[] synLine = it.next();
///if ( synLine[0].length() > config.MAX_LENGTH ) {
/// continue;
///}
//check if the baseWord is exists or not
IWord baseWord = get(ILexicon.CJK_WORD, synLine[0]);
if ( baseWord == null ) {
continue;
}
/*
* first get the synonyms entry from the root map
* create a new one and map it with the root word if it not exists
*/
SynonymsEntry synEntry = rootMap.get(baseWord.getValue());
if ( synEntry == null ) {
synEntry = new SynonymsEntry(baseWord);
rootMap.put(baseWord.getValue(), synEntry);
synEntry.add(baseWord); //add the base word first
}
for ( int i = 1; i < synLine.length; i++ ) {
String[] parts = synLine[i].split("\\s*/\\s*");
///if ( parts[0].length() > config.MAX_LENGTH ) {
/// continue;
///}
/* Ignore the synonyms define that is already existed */
for ( final IWord w : synEntry.getList() ) {
if ( w.getValue().equals(parts[0]) ) {
continue;
}
}
//check if the word is exists or not
// or create a new one
IWord synWord = get(ILexicon.CJK_WORD, parts[0]);
if ( synWord == null ) {
synWord = new Word(parts[0], IWord.T_CJK_WORD);
add(ILexicon.CJK_WORD, synWord);
}
//check and extends the part of speech from the baseWord
if ( synWord.getPartSpeech() == null ) {
synWord.setPartSpeech(baseWord.getPartSpeech());
}
//check and extends the entity from the baseWord
if ( synWord.getEntity() == null ) {
synWord.setEntity(baseWord.getEntity());
}
//check and set the pinyin
if ( parts.length > 1 ) {
synWord.setPinyin(parts[1]);
}
synEntry.add(synWord);
}
}
synBuffer.clear();
}
} | /**
* 1, synonyms words to synonyms entry
* 2, loop each synonyms word and set the IWord#synEntry
* 3, clear the synonyms buffer
*/ | 1, synonyms words to synonyms entry
2, loop each synonyms word and set the IWord#synEntry
3, clear the synonyms buffer | [
"1",
"synonyms",
"words",
"to",
"synonyms",
"entry",
"2",
"loop",
"each",
"synonyms",
"word",
"and",
"set",
"the",
"IWord#synEntry",
"3",
"clear",
"the",
"synonyms",
"buffer"
] | public void resetSynonymsNet()
{
synchronized (synBuffer) {
if ( synBuffer.size() == 0 ) {
return;
}
Iterator<String[]> it = synBuffer.iterator();
while ( it.hasNext() ) {
String[] synLine = it.next();
IWord baseWord = get(ILexicon.CJK_WORD, synLine[0]);
if ( baseWord == null ) {
continue;
}
/*
* first get the synonyms entry from the root map
* create a new one and map it with the root word if it not exists
*/
SynonymsEntry synEntry = rootMap.get(baseWord.getValue());
if ( synEntry == null ) {
synEntry = new SynonymsEntry(baseWord);
rootMap.put(baseWord.getValue(), synEntry);
synEntry.add(baseWord);
}
for ( int i = 1; i < synLine.length; i++ ) {
String[] parts = synLine[i].split("\\s*/\\s*");
/* Ignore the synonyms define that is already existed */
for ( final IWord w : synEntry.getList() ) {
if ( w.getValue().equals(parts[0]) ) {
continue;
}
}
IWord synWord = get(ILexicon.CJK_WORD, parts[0]);
if ( synWord == null ) {
synWord = new Word(parts[0], IWord.T_CJK_WORD);
add(ILexicon.CJK_WORD, synWord);
}
if ( synWord.getPartSpeech() == null ) {
synWord.setPartSpeech(baseWord.getPartSpeech());
}
if ( synWord.getEntity() == null ) {
synWord.setEntity(baseWord.getEntity());
}
if ( parts.length > 1 ) {
synWord.setPinyin(parts[1]);
}
synEntry.add(synWord);
}
}
synBuffer.clear();
}
} | [
"public",
"void",
"resetSynonymsNet",
"(",
")",
"{",
"synchronized",
"(",
"synBuffer",
")",
"{",
"if",
"(",
"synBuffer",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"Iterator",
"<",
"String",
"[",
"]",
">",
"it",
"=",
"synBuffer",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"[",
"]",
"synLine",
"=",
"it",
".",
"next",
"(",
")",
";",
"IWord",
"baseWord",
"=",
"get",
"(",
"ILexicon",
".",
"CJK_WORD",
",",
"synLine",
"[",
"0",
"]",
")",
";",
"if",
"(",
"baseWord",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"/*\n * first get the synonyms entry from the root map\n * create a new one and map it with the root word if it not exists \n */",
"SynonymsEntry",
"synEntry",
"=",
"rootMap",
".",
"get",
"(",
"baseWord",
".",
"getValue",
"(",
")",
")",
";",
"if",
"(",
"synEntry",
"==",
"null",
")",
"{",
"synEntry",
"=",
"new",
"SynonymsEntry",
"(",
"baseWord",
")",
";",
"rootMap",
".",
"put",
"(",
"baseWord",
".",
"getValue",
"(",
")",
",",
"synEntry",
")",
";",
"synEntry",
".",
"add",
"(",
"baseWord",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"synLine",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"synLine",
"[",
"i",
"]",
".",
"split",
"(",
"\"\\\\s*/\\\\s*\"",
")",
";",
"/* Ignore the synonyms define that is already existed */",
"for",
"(",
"final",
"IWord",
"w",
":",
"synEntry",
".",
"getList",
"(",
")",
")",
"{",
"if",
"(",
"w",
".",
"getValue",
"(",
")",
".",
"equals",
"(",
"parts",
"[",
"0",
"]",
")",
")",
"{",
"continue",
";",
"}",
"}",
"IWord",
"synWord",
"=",
"get",
"(",
"ILexicon",
".",
"CJK_WORD",
",",
"parts",
"[",
"0",
"]",
")",
";",
"if",
"(",
"synWord",
"==",
"null",
")",
"{",
"synWord",
"=",
"new",
"Word",
"(",
"parts",
"[",
"0",
"]",
",",
"IWord",
".",
"T_CJK_WORD",
")",
";",
"add",
"(",
"ILexicon",
".",
"CJK_WORD",
",",
"synWord",
")",
";",
"}",
"if",
"(",
"synWord",
".",
"getPartSpeech",
"(",
")",
"==",
"null",
")",
"{",
"synWord",
".",
"setPartSpeech",
"(",
"baseWord",
".",
"getPartSpeech",
"(",
")",
")",
";",
"}",
"if",
"(",
"synWord",
".",
"getEntity",
"(",
")",
"==",
"null",
")",
"{",
"synWord",
".",
"setEntity",
"(",
"baseWord",
".",
"getEntity",
"(",
")",
")",
";",
"}",
"if",
"(",
"parts",
".",
"length",
">",
"1",
")",
"{",
"synWord",
".",
"setPinyin",
"(",
"parts",
"[",
"1",
"]",
")",
";",
"}",
"synEntry",
".",
"add",
"(",
"synWord",
")",
";",
"}",
"}",
"synBuffer",
".",
"clear",
"(",
")",
";",
"}",
"}"
] | 1, synonyms words to synonyms entry
2, loop each synonyms word and set the IWord#synEntry
3, clear the synonyms buffer | [
"1",
"synonyms",
"words",
"to",
"synonyms",
"entry",
"2",
"loop",
"each",
"synonyms",
"word",
"and",
"set",
"the",
"IWord#synEntry",
"3",
"clear",
"the",
"synonyms",
"buffer"
] | [
"///if ( synLine[0].length() > config.MAX_LENGTH ) {",
"/// continue;",
"///}",
"//check if the baseWord is exists or not",
"//add the base word first",
"///if ( parts[0].length() > config.MAX_LENGTH ) {",
"/// continue;",
"///}",
"//check if the word is exists or not",
"// or create a new one",
"//check and extends the part of speech from the baseWord",
"//check and extends the entity from the baseWord",
"//check and set the pinyin"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
2715,
10503,
16968,
7308,
1435,
203,
565,
288,
203,
3639,
3852,
261,
11982,
1892,
13,
288,
203,
5411,
309,
261,
6194,
1892,
18,
1467,
1435,
422,
374,
262,
288,
203,
7734,
327,
31,
203,
5411,
289,
203,
2398,
203,
5411,
4498,
32,
780,
8526,
34,
518,
273,
6194,
1892,
18,
9838,
5621,
203,
5411,
1323,
261,
518,
18,
5332,
2134,
1435,
262,
288,
203,
7734,
514,
8526,
6194,
1670,
273,
518,
18,
4285,
5621,
203,
1171,
203,
7734,
18378,
430,
261,
6194,
1670,
63,
20,
8009,
2469,
1435,
405,
642,
18,
6694,
67,
7096,
262,
288,
203,
7734,
18378,
565,
1324,
31,
203,
7734,
18378,
97,
203,
1171,
203,
7734,
368,
1893,
309,
326,
1026,
3944,
353,
1704,
578,
486,
203,
7734,
467,
3944,
1026,
3944,
273,
336,
12,
2627,
338,
3950,
18,
39,
19474,
67,
7952,
16,
6194,
1670,
63,
20,
19226,
203,
7734,
309,
261,
1026,
3944,
422,
446,
262,
288,
203,
10792,
1324,
31,
203,
7734,
289,
203,
1171,
203,
7734,
1748,
203,
1171,
380,
1122,
336,
326,
27260,
1241,
628,
326,
1365,
852,
203,
1171,
380,
752,
279,
394,
1245,
471,
852,
518,
598,
326,
1365,
2076,
309,
518,
486,
1704,
7010,
7734,
1195,
203,
7734,
16091,
16968,
1622,
6194,
1622,
273,
1365,
863,
18,
588,
12,
1969,
3944,
18,
24805,
10663,
203,
7734,
309,
261,
6194,
1622,
422,
446,
262,
288,
203,
10792,
6194,
1622,
273,
394,
16091,
16968,
1622,
12,
1969,
3944,
1769,
203,
10792,
1365,
863,
18,
458,
12,
1969,
3944,
18,
24805,
9334,
6194,
1622,
1769,
203,
10792,
6194,
1622,
18,
1289,
12,
1969,
3944,
1769,
368,
1289,
326,
1026,
2076,
1122,
203,
7734,
289,
203,
1171,
203,
7734,
364,
261,
509,
277,
273,
404,
31,
277,
411,
6194,
1670,
18,
2469,
31,
277,
9904,
262,
288,
203,
10792,
514,
8526,
2140,
273,
6194,
1670,
63,
77,
8009,
4939,
2932,
1695,
87,
5549,
1695,
87,
7388,
1769,
203,
10792,
18378,
430,
261,
2140,
63,
20,
8009,
2469,
1435,
405,
642,
18,
6694,
67,
7096,
262,
288,
203,
10792,
18378,
565,
1324,
31,
203,
10792,
18378,
97,
203,
5397,
203,
10792,
1748,
8049,
326,
27260,
4426,
716,
353,
1818,
20419,
1195,
203,
10792,
364,
261,
727,
467,
3944,
341,
294,
6194,
1622,
18,
588,
682,
1435,
262,
288,
203,
5397,
202,
430,
261,
341,
18,
24805,
7675,
14963,
12,
6019,
63,
20,
5717,
262,
288,
203,
5397,
202,
202,
17143,
31,
203,
5397,
202,
97,
203,
10792,
289,
203,
5397,
203,
10792,
368,
1893,
309,
326,
2076,
353,
1704,
578,
486,
203,
10792,
368,
225,
578,
752,
279,
394,
1245,
203,
10792,
467,
3944,
6194,
3944,
273,
336,
12,
2627,
338,
3950,
18,
39,
19474,
67,
7952,
16,
2140,
63,
20,
19226,
203,
10792,
309,
261,
6194,
3944,
422,
446,
262,
288,
203,
13491,
6194,
3944,
273,
394,
9926,
12,
6019,
63,
20,
6487,
467,
3944,
18,
56,
67,
39,
19474,
67,
7952,
1769,
203,
13491,
527,
12,
2627,
338,
3950,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
404,
16,
27260,
4511,
358,
27260,
1241,
203,
377,
380,
576,
16,
2798,
1517,
27260,
2076,
471,
444,
326,
467,
3944,
7,
11982,
1622,
203,
377,
380,
890,
16,
2424,
326,
27260,
1613,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
b6f4ab110a1a5a373b3451307b1b681d3fd30c2d | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/dic/ADictionary.java | [
"Apache-2.0"
] | Java | loadWords | null | public static void loadWords(
SegmenterConfig config, ADictionary dic, File file, List<String[]> buffer )
throws NumberFormatException, FileNotFoundException, IOException
{
loadWords(config, dic, new FileInputStream(file), buffer);
} | /**
* load all the words in the specified lexicon file into the dictionary
*
* @param config
* @param dic
* @param file
* @param buffer
* @throws IOException
* @throws FileNotFoundException
* @throws NumberFormatException
*/ | load all the words in the specified lexicon file into the dictionary
| [
"load",
"all",
"the",
"words",
"in",
"the",
"specified",
"lexicon",
"file",
"into",
"the",
"dictionary"
] | public static void loadWords(
SegmenterConfig config, ADictionary dic, File file, List<String[]> buffer )
throws NumberFormatException, FileNotFoundException, IOException
{
loadWords(config, dic, new FileInputStream(file), buffer);
} | [
"public",
"static",
"void",
"loadWords",
"(",
"SegmenterConfig",
"config",
",",
"ADictionary",
"dic",
",",
"File",
"file",
",",
"List",
"<",
"String",
"[",
"]",
">",
"buffer",
")",
"throws",
"NumberFormatException",
",",
"FileNotFoundException",
",",
"IOException",
"{",
"loadWords",
"(",
"config",
",",
"dic",
",",
"new",
"FileInputStream",
"(",
"file",
")",
",",
"buffer",
")",
";",
"}"
] | load all the words in the specified lexicon file into the dictionary | [
"load",
"all",
"the",
"words",
"in",
"the",
"specified",
"lexicon",
"file",
"into",
"the",
"dictionary"
] | [] | [
{
"param": "config",
"type": "SegmenterConfig"
},
{
"param": "dic",
"type": "ADictionary"
},
{
"param": "file",
"type": "File"
},
{
"param": "buffer",
"type": "List<String[]>"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": "SegmenterConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dic",
"type": "ADictionary",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "buffer",
"type": "List<String[]>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
918,
1262,
7363,
12,
7010,
5411,
10807,
264,
809,
642,
16,
432,
10905,
11681,
16,
1387,
585,
16,
987,
32,
780,
8526,
34,
1613,
262,
7010,
5411,
1216,
12100,
16,
13707,
16,
1860,
7010,
565,
288,
203,
3639,
1262,
7363,
12,
1425,
16,
11681,
16,
394,
11907,
12,
768,
3631,
1613,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1262,
777,
326,
4511,
316,
326,
1269,
31681,
585,
1368,
326,
3880,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
642,
203,
377,
380,
632,
891,
282,
11681,
203,
377,
380,
632,
891,
282,
585,
203,
377,
380,
632,
891,
282,
1613,
203,
377,
380,
632,
15069,
225,
1860,
7010,
377,
380,
632,
15069,
225,
13707,
7010,
377,
380,
632,
15069,
225,
12100,
7010,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
b6f4ab110a1a5a373b3451307b1b681d3fd30c2d | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/dic/ADictionary.java | [
"Apache-2.0"
] | Java | loadWords | null | public static void loadWords(
SegmenterConfig config, ADictionary dic, String file, List<String[]> buffer )
throws NumberFormatException, FileNotFoundException, IOException
{
loadWords(config, dic, new FileInputStream(file), buffer);
} | /**
* load all the words from a specified lexicon file path
*
* @param config
* @param dic
* @param file
* @param buffer
* @throws IOException
* @throws FileNotFoundException
* @throws NumberFormatException
*/ | load all the words from a specified lexicon file path
| [
"load",
"all",
"the",
"words",
"from",
"a",
"specified",
"lexicon",
"file",
"path"
] | public static void loadWords(
SegmenterConfig config, ADictionary dic, String file, List<String[]> buffer )
throws NumberFormatException, FileNotFoundException, IOException
{
loadWords(config, dic, new FileInputStream(file), buffer);
} | [
"public",
"static",
"void",
"loadWords",
"(",
"SegmenterConfig",
"config",
",",
"ADictionary",
"dic",
",",
"String",
"file",
",",
"List",
"<",
"String",
"[",
"]",
">",
"buffer",
")",
"throws",
"NumberFormatException",
",",
"FileNotFoundException",
",",
"IOException",
"{",
"loadWords",
"(",
"config",
",",
"dic",
",",
"new",
"FileInputStream",
"(",
"file",
")",
",",
"buffer",
")",
";",
"}"
] | load all the words from a specified lexicon file path | [
"load",
"all",
"the",
"words",
"from",
"a",
"specified",
"lexicon",
"file",
"path"
] | [] | [
{
"param": "config",
"type": "SegmenterConfig"
},
{
"param": "dic",
"type": "ADictionary"
},
{
"param": "file",
"type": "String"
},
{
"param": "buffer",
"type": "List<String[]>"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": "SegmenterConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dic",
"type": "ADictionary",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "buffer",
"type": "List<String[]>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
918,
1262,
7363,
12,
7010,
5411,
10807,
264,
809,
642,
16,
432,
10905,
11681,
16,
514,
585,
16,
987,
32,
780,
8526,
34,
1613,
262,
7010,
5411,
1216,
12100,
16,
13707,
16,
1860,
203,
565,
288,
203,
3639,
1262,
7363,
12,
1425,
16,
11681,
16,
394,
11907,
12,
768,
3631,
1613,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1262,
777,
326,
4511,
628,
279,
1269,
31681,
585,
589,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
642,
203,
377,
380,
632,
891,
282,
11681,
203,
377,
380,
632,
891,
282,
585,
203,
377,
380,
632,
891,
282,
1613,
203,
377,
380,
632,
15069,
225,
1860,
7010,
377,
380,
632,
15069,
225,
13707,
7010,
377,
380,
632,
15069,
225,
12100,
7010,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
b6f4ab110a1a5a373b3451307b1b681d3fd30c2d | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/dic/ADictionary.java | [
"Apache-2.0"
] | Java | resetPrefixLength | null | public static boolean resetPrefixLength(SegmenterConfig config, ADictionary dic, int mixLength)
{
if ( mixLength <= config.MAX_LENGTH
&& mixLength > dic.mixPrefixLength ) {
dic.mixPrefixLength = mixLength;
return true;
}
return false;
} | /**
* check and reset the value of {@link ADictionary#mixPrefixLength}
*
* @param config
* @param dic
* @param mixLength
* @return boolean
*/ | check and reset the value of ADictionary#mixPrefixLength
| [
"check",
"and",
"reset",
"the",
"value",
"of",
"ADictionary#mixPrefixLength"
] | public static boolean resetPrefixLength(SegmenterConfig config, ADictionary dic, int mixLength)
{
if ( mixLength <= config.MAX_LENGTH
&& mixLength > dic.mixPrefixLength ) {
dic.mixPrefixLength = mixLength;
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"resetPrefixLength",
"(",
"SegmenterConfig",
"config",
",",
"ADictionary",
"dic",
",",
"int",
"mixLength",
")",
"{",
"if",
"(",
"mixLength",
"<=",
"config",
".",
"MAX_LENGTH",
"&&",
"mixLength",
">",
"dic",
".",
"mixPrefixLength",
")",
"{",
"dic",
".",
"mixPrefixLength",
"=",
"mixLength",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | check and reset the value of {@link ADictionary#mixPrefixLength} | [
"check",
"and",
"reset",
"the",
"value",
"of",
"{",
"@link",
"ADictionary#mixPrefixLength",
"}"
] | [] | [
{
"param": "config",
"type": "SegmenterConfig"
},
{
"param": "dic",
"type": "ADictionary"
},
{
"param": "mixLength",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": "SegmenterConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dic",
"type": "ADictionary",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mixLength",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
2715,
2244,
1782,
12,
4131,
264,
809,
642,
16,
432,
10905,
11681,
16,
509,
6843,
1782,
13,
203,
565,
288,
203,
3639,
309,
261,
6843,
1782,
1648,
642,
18,
6694,
67,
7096,
7010,
7734,
597,
6843,
1782,
405,
11681,
18,
14860,
2244,
1782,
262,
288,
203,
5411,
11681,
18,
14860,
2244,
1782,
273,
6843,
1782,
31,
203,
5411,
327,
638,
31,
203,
3639,
289,
203,
540,
203,
3639,
327,
629,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
866,
471,
2715,
326,
460,
434,
8901,
1232,
432,
10905,
7,
14860,
2244,
1782,
97,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
642,
203,
377,
380,
632,
891,
282,
11681,
203,
377,
380,
632,
891,
282,
6843,
1782,
203,
377,
380,
632,
2463,
225,
1250,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
b6f4ab110a1a5a373b3451307b1b681d3fd30c2d | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/dic/ADictionary.java | [
"Apache-2.0"
] | Java | resetSuffixLength | null | public static boolean resetSuffixLength(SegmenterConfig config, ADictionary dic, int mixLength)
{
if ( mixLength <= config.MAX_LENGTH
&& mixLength > dic.mixSuffixLength ) {
dic.mixSuffixLength = mixLength;
return true;
}
return false;
} | /**
* check and reset the value of the {@link ADictionary#mixSuffixLength}
*
* @param config
* @param dic
* @param mixLength
* @return boolean
*/ | check and reset the value of the ADictionary#mixSuffixLength
| [
"check",
"and",
"reset",
"the",
"value",
"of",
"the",
"ADictionary#mixSuffixLength"
] | public static boolean resetSuffixLength(SegmenterConfig config, ADictionary dic, int mixLength)
{
if ( mixLength <= config.MAX_LENGTH
&& mixLength > dic.mixSuffixLength ) {
dic.mixSuffixLength = mixLength;
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"resetSuffixLength",
"(",
"SegmenterConfig",
"config",
",",
"ADictionary",
"dic",
",",
"int",
"mixLength",
")",
"{",
"if",
"(",
"mixLength",
"<=",
"config",
".",
"MAX_LENGTH",
"&&",
"mixLength",
">",
"dic",
".",
"mixSuffixLength",
")",
"{",
"dic",
".",
"mixSuffixLength",
"=",
"mixLength",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | check and reset the value of the {@link ADictionary#mixSuffixLength} | [
"check",
"and",
"reset",
"the",
"value",
"of",
"the",
"{",
"@link",
"ADictionary#mixSuffixLength",
"}"
] | [] | [
{
"param": "config",
"type": "SegmenterConfig"
},
{
"param": "dic",
"type": "ADictionary"
},
{
"param": "mixLength",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": "SegmenterConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dic",
"type": "ADictionary",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mixLength",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
2715,
5791,
1782,
12,
4131,
264,
809,
642,
16,
432,
10905,
11681,
16,
509,
6843,
1782,
13,
203,
565,
288,
203,
3639,
309,
261,
6843,
1782,
1648,
642,
18,
6694,
67,
7096,
7010,
7734,
597,
6843,
1782,
405,
11681,
18,
14860,
5791,
1782,
262,
288,
203,
5411,
11681,
18,
14860,
5791,
1782,
273,
6843,
1782,
31,
203,
5411,
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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
866,
471,
2715,
326,
460,
434,
326,
8901,
1232,
432,
10905,
7,
14860,
5791,
1782,
97,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
642,
203,
377,
380,
632,
891,
282,
11681,
203,
377,
380,
632,
891,
282,
6843,
1782,
203,
377,
380,
632,
2463,
225,
1250,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
2925afa08b341cc127c3b722cd1b93e9cf96aea9 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/EntityFormat.java | [
"Apache-2.0"
] | Java | isMailAddress | null | public final static boolean isMailAddress(String str)
{
int atIndex = str.indexOf('@');
if ( atIndex == -1 ) {
return false;
}
if ( ! StringUtil.isLetterOrNumeric(str, 0, atIndex) ) {
return false;
}
int ptIndex, ptStart = atIndex + 1;
while ( (ptIndex = str.indexOf('.', ptStart)) > 0 ) {
if ( ptIndex == ptStart ) {
return false;
}
if ( ! StringUtil.isLetterOrNumeric(str, ptStart, ptIndex) ) {
return false;
}
ptStart = ptIndex + 1;
}
if ( ptStart < str.length()
&& ! StringUtil.isLetterOrNumeric(str, ptStart, str.length()) ) {
return false;
}
return true;
} | /**
* check if the specified string is an email address or not
*
* @param str
* @return boolean
*/ | check if the specified string is an email address or not
@param str
@return boolean | [
"check",
"if",
"the",
"specified",
"string",
"is",
"an",
"email",
"address",
"or",
"not",
"@param",
"str",
"@return",
"boolean"
] | public final static boolean isMailAddress(String str)
{
int atIndex = str.indexOf('@');
if ( atIndex == -1 ) {
return false;
}
if ( ! StringUtil.isLetterOrNumeric(str, 0, atIndex) ) {
return false;
}
int ptIndex, ptStart = atIndex + 1;
while ( (ptIndex = str.indexOf('.', ptStart)) > 0 ) {
if ( ptIndex == ptStart ) {
return false;
}
if ( ! StringUtil.isLetterOrNumeric(str, ptStart, ptIndex) ) {
return false;
}
ptStart = ptIndex + 1;
}
if ( ptStart < str.length()
&& ! StringUtil.isLetterOrNumeric(str, ptStart, str.length()) ) {
return false;
}
return true;
} | [
"public",
"final",
"static",
"boolean",
"isMailAddress",
"(",
"String",
"str",
")",
"{",
"int",
"atIndex",
"=",
"str",
".",
"indexOf",
"(",
"'@'",
")",
";",
"if",
"(",
"atIndex",
"==",
"-",
"1",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"StringUtil",
".",
"isLetterOrNumeric",
"(",
"str",
",",
"0",
",",
"atIndex",
")",
")",
"{",
"return",
"false",
";",
"}",
"int",
"ptIndex",
",",
"ptStart",
"=",
"atIndex",
"+",
"1",
";",
"while",
"(",
"(",
"ptIndex",
"=",
"str",
".",
"indexOf",
"(",
"'.'",
",",
"ptStart",
")",
")",
">",
"0",
")",
"{",
"if",
"(",
"ptIndex",
"==",
"ptStart",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"StringUtil",
".",
"isLetterOrNumeric",
"(",
"str",
",",
"ptStart",
",",
"ptIndex",
")",
")",
"{",
"return",
"false",
";",
"}",
"ptStart",
"=",
"ptIndex",
"+",
"1",
";",
"}",
"if",
"(",
"ptStart",
"<",
"str",
".",
"length",
"(",
")",
"&&",
"!",
"StringUtil",
".",
"isLetterOrNumeric",
"(",
"str",
",",
"ptStart",
",",
"str",
".",
"length",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | check if the specified string is an email address or not | [
"check",
"if",
"the",
"specified",
"string",
"is",
"an",
"email",
"address",
"or",
"not"
] | [] | [
{
"param": "str",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
727,
760,
1250,
353,
6759,
1887,
12,
780,
609,
13,
203,
565,
288,
203,
3639,
509,
622,
1016,
273,
609,
18,
31806,
2668,
36,
8284,
203,
3639,
309,
261,
622,
1016,
422,
300,
21,
262,
288,
203,
5411,
327,
629,
31,
203,
3639,
289,
203,
540,
203,
3639,
309,
261,
401,
14205,
18,
291,
13938,
1162,
9902,
12,
701,
16,
374,
16,
622,
1016,
13,
262,
288,
203,
5411,
327,
629,
31,
203,
3639,
289,
203,
540,
203,
3639,
509,
5818,
1016,
16,
5818,
1685,
273,
622,
1016,
397,
404,
31,
203,
3639,
1323,
261,
261,
337,
1016,
273,
609,
18,
31806,
2668,
1093,
16,
5818,
1685,
3719,
405,
374,
262,
288,
203,
5411,
309,
261,
5818,
1016,
422,
5818,
1685,
262,
288,
203,
7734,
327,
629,
31,
203,
5411,
289,
203,
2398,
203,
5411,
309,
261,
401,
14205,
18,
291,
13938,
1162,
9902,
12,
701,
16,
5818,
1685,
16,
5818,
1016,
13,
262,
288,
203,
7734,
327,
629,
31,
203,
5411,
289,
203,
2398,
203,
5411,
5818,
1685,
273,
5818,
1016,
397,
404,
31,
203,
3639,
289,
203,
540,
203,
3639,
309,
261,
5818,
1685,
411,
609,
18,
2469,
1435,
7010,
7734,
597,
401,
14205,
18,
291,
13938,
1162,
9902,
12,
701,
16,
5818,
1685,
16,
609,
18,
2469,
10756,
262,
288,
203,
5411,
327,
629,
31,
203,
3639,
289,
203,
540,
203,
3639,
327,
638,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0
] | [
1,
26873,
203,
377,
380,
866,
309,
326,
1269,
533,
353,
392,
2699,
1758,
578,
486,
7010,
377,
380,
7010,
377,
380,
632,
891,
282,
609,
203,
377,
380,
632,
2463,
225,
1250,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
2925afa08b341cc127c3b722cd1b93e9cf96aea9 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/EntityFormat.java | [
"Apache-2.0"
] | Java | isUrlAddress | null | public final static boolean isUrlAddress(String str, ADictionary dic)
{
int prIndex = str.indexOf("://");
if ( prIndex > -1 && ! StringUtil.isLatin(str, 0, prIndex) ) {
return false;
}
int sIdx = prIndex > -1 ? prIndex + 3 : 0;
int slIndex = str.indexOf('/', sIdx), sgIndex = str.indexOf('?', sIdx);
int eIdx = slIndex > -1 ? slIndex : (sgIndex > -1 ? sgIndex : str.length());
int lpIndex = -1;
for ( int i = sIdx; i < eIdx; i++ ) {
char chr = str.charAt(i);
if ( chr == '.' ) {
if ( lpIndex == -1 ) {
lpIndex = i;
continue;
}
if ( (i - lpIndex) == 1 || i == (eIdx - 1)) {
return false;
}
lpIndex = i;
} else if ( ! StringUtil.isEnLetter(chr)
&& ! StringUtil.isEnNumeric(chr) ) {
return false;
}
}
if ( dic != null && ! dic.match(ILexicon.DOMAIN_SUFFIX,
str.substring(lpIndex+1, eIdx)) ) {
return false;
}
//check the path part
if ( slIndex > -1 ) {
sIdx = slIndex;
eIdx = sgIndex > -1 ? sgIndex : str.length();
lpIndex = -1;
for ( int i = sIdx; i < eIdx; i++ ) {
char chr = str.charAt(i);
if ( "./-_".indexOf(chr) > -1 ) {
if ( lpIndex == -1 ) {
lpIndex = i;
continue;
}
if ( i - lpIndex == 1 || (chr == '.' && i == (eIdx - 1)) ) {
return false;
}
lpIndex = i;
} else if ( ! StringUtil.isEnLetter(chr)
&& ! StringUtil.isEnNumeric(chr) ) {
return false;
}
}
}
return true;
} | /**
* check if the specified string is an URL address or not
*
* @param str
* @param dic optional dictionary object
* @return boolean
*/ | check if the specified string is an URL address or not
@param str
@param dic optional dictionary object
@return boolean | [
"check",
"if",
"the",
"specified",
"string",
"is",
"an",
"URL",
"address",
"or",
"not",
"@param",
"str",
"@param",
"dic",
"optional",
"dictionary",
"object",
"@return",
"boolean"
] | public final static boolean isUrlAddress(String str, ADictionary dic)
{
int prIndex = str.indexOf("://");
if ( prIndex > -1 && ! StringUtil.isLatin(str, 0, prIndex) ) {
return false;
}
int sIdx = prIndex > -1 ? prIndex + 3 : 0;
int slIndex = str.indexOf('/', sIdx), sgIndex = str.indexOf('?', sIdx);
int eIdx = slIndex > -1 ? slIndex : (sgIndex > -1 ? sgIndex : str.length());
int lpIndex = -1;
for ( int i = sIdx; i < eIdx; i++ ) {
char chr = str.charAt(i);
if ( chr == '.' ) {
if ( lpIndex == -1 ) {
lpIndex = i;
continue;
}
if ( (i - lpIndex) == 1 || i == (eIdx - 1)) {
return false;
}
lpIndex = i;
} else if ( ! StringUtil.isEnLetter(chr)
&& ! StringUtil.isEnNumeric(chr) ) {
return false;
}
}
if ( dic != null && ! dic.match(ILexicon.DOMAIN_SUFFIX,
str.substring(lpIndex+1, eIdx)) ) {
return false;
}
if ( slIndex > -1 ) {
sIdx = slIndex;
eIdx = sgIndex > -1 ? sgIndex : str.length();
lpIndex = -1;
for ( int i = sIdx; i < eIdx; i++ ) {
char chr = str.charAt(i);
if ( "./-_".indexOf(chr) > -1 ) {
if ( lpIndex == -1 ) {
lpIndex = i;
continue;
}
if ( i - lpIndex == 1 || (chr == '.' && i == (eIdx - 1)) ) {
return false;
}
lpIndex = i;
} else if ( ! StringUtil.isEnLetter(chr)
&& ! StringUtil.isEnNumeric(chr) ) {
return false;
}
}
}
return true;
} | [
"public",
"final",
"static",
"boolean",
"isUrlAddress",
"(",
"String",
"str",
",",
"ADictionary",
"dic",
")",
"{",
"int",
"prIndex",
"=",
"str",
".",
"indexOf",
"(",
"\"://\"",
")",
";",
"if",
"(",
"prIndex",
">",
"-",
"1",
"&&",
"!",
"StringUtil",
".",
"isLatin",
"(",
"str",
",",
"0",
",",
"prIndex",
")",
")",
"{",
"return",
"false",
";",
"}",
"int",
"sIdx",
"=",
"prIndex",
">",
"-",
"1",
"?",
"prIndex",
"+",
"3",
":",
"0",
";",
"int",
"slIndex",
"=",
"str",
".",
"indexOf",
"(",
"'/'",
",",
"sIdx",
")",
",",
"sgIndex",
"=",
"str",
".",
"indexOf",
"(",
"'?'",
",",
"sIdx",
")",
";",
"int",
"eIdx",
"=",
"slIndex",
">",
"-",
"1",
"?",
"slIndex",
":",
"(",
"sgIndex",
">",
"-",
"1",
"?",
"sgIndex",
":",
"str",
".",
"length",
"(",
")",
")",
";",
"int",
"lpIndex",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"sIdx",
";",
"i",
"<",
"eIdx",
";",
"i",
"++",
")",
"{",
"char",
"chr",
"=",
"str",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"chr",
"==",
"'.'",
")",
"{",
"if",
"(",
"lpIndex",
"==",
"-",
"1",
")",
"{",
"lpIndex",
"=",
"i",
";",
"continue",
";",
"}",
"if",
"(",
"(",
"i",
"-",
"lpIndex",
")",
"==",
"1",
"||",
"i",
"==",
"(",
"eIdx",
"-",
"1",
")",
")",
"{",
"return",
"false",
";",
"}",
"lpIndex",
"=",
"i",
";",
"}",
"else",
"if",
"(",
"!",
"StringUtil",
".",
"isEnLetter",
"(",
"chr",
")",
"&&",
"!",
"StringUtil",
".",
"isEnNumeric",
"(",
"chr",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"if",
"(",
"dic",
"!=",
"null",
"&&",
"!",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"DOMAIN_SUFFIX",
",",
"str",
".",
"substring",
"(",
"lpIndex",
"+",
"1",
",",
"eIdx",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"slIndex",
">",
"-",
"1",
")",
"{",
"sIdx",
"=",
"slIndex",
";",
"eIdx",
"=",
"sgIndex",
">",
"-",
"1",
"?",
"sgIndex",
":",
"str",
".",
"length",
"(",
")",
";",
"lpIndex",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"sIdx",
";",
"i",
"<",
"eIdx",
";",
"i",
"++",
")",
"{",
"char",
"chr",
"=",
"str",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"\"./-_\"",
".",
"indexOf",
"(",
"chr",
")",
">",
"-",
"1",
")",
"{",
"if",
"(",
"lpIndex",
"==",
"-",
"1",
")",
"{",
"lpIndex",
"=",
"i",
";",
"continue",
";",
"}",
"if",
"(",
"i",
"-",
"lpIndex",
"==",
"1",
"||",
"(",
"chr",
"==",
"'.'",
"&&",
"i",
"==",
"(",
"eIdx",
"-",
"1",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"lpIndex",
"=",
"i",
";",
"}",
"else",
"if",
"(",
"!",
"StringUtil",
".",
"isEnLetter",
"(",
"chr",
")",
"&&",
"!",
"StringUtil",
".",
"isEnNumeric",
"(",
"chr",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"}",
"return",
"true",
";",
"}"
] | check if the specified string is an URL address or not | [
"check",
"if",
"the",
"specified",
"string",
"is",
"an",
"URL",
"address",
"or",
"not"
] | [
"//check the path part"
] | [
{
"param": "str",
"type": "String"
},
{
"param": "dic",
"type": "ADictionary"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dic",
"type": "ADictionary",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
727,
760,
1250,
353,
1489,
1887,
12,
780,
609,
16,
432,
10905,
11681,
13,
203,
565,
288,
203,
3639,
509,
846,
1016,
273,
609,
18,
31806,
2932,
2207,
8863,
203,
3639,
309,
261,
846,
1016,
405,
300,
21,
597,
401,
14205,
18,
291,
6607,
267,
12,
701,
16,
374,
16,
846,
1016,
13,
262,
288,
203,
5411,
327,
629,
31,
203,
3639,
289,
203,
540,
203,
3639,
509,
272,
4223,
273,
846,
1016,
405,
300,
21,
692,
846,
1016,
397,
890,
294,
374,
31,
203,
3639,
509,
2020,
1016,
273,
609,
18,
31806,
2668,
19,
2187,
272,
4223,
3631,
11150,
1016,
273,
609,
18,
31806,
2668,
35,
2187,
272,
4223,
1769,
203,
3639,
509,
425,
4223,
273,
2020,
1016,
405,
300,
21,
692,
2020,
1016,
294,
261,
1055,
1016,
405,
300,
21,
692,
11150,
1016,
294,
609,
18,
2469,
10663,
203,
3639,
509,
12423,
1016,
273,
300,
21,
31,
203,
3639,
364,
261,
509,
277,
273,
272,
4223,
31,
277,
411,
425,
4223,
31,
277,
9904,
262,
288,
203,
5411,
1149,
4513,
273,
609,
18,
3001,
861,
12,
77,
1769,
203,
5411,
309,
261,
4513,
422,
2611,
262,
288,
203,
7734,
309,
261,
12423,
1016,
422,
300,
21,
262,
288,
203,
10792,
12423,
1016,
273,
277,
31,
203,
10792,
1324,
31,
203,
7734,
289,
203,
1171,
203,
7734,
309,
261,
261,
77,
300,
12423,
1016,
13,
422,
404,
747,
277,
422,
261,
73,
4223,
300,
404,
3719,
288,
203,
10792,
327,
629,
31,
203,
7734,
289,
203,
1171,
203,
7734,
12423,
1016,
273,
277,
31,
203,
5411,
289,
469,
309,
261,
401,
14205,
18,
291,
664,
13938,
12,
15182,
13,
7010,
10792,
597,
401,
14205,
18,
291,
664,
9902,
12,
15182,
13,
262,
288,
203,
7734,
327,
629,
31,
203,
5411,
289,
203,
3639,
289,
203,
540,
203,
3639,
309,
261,
11681,
480,
446,
597,
401,
11681,
18,
1916,
12,
2627,
338,
3950,
18,
18192,
67,
14964,
16,
7010,
7734,
609,
18,
28023,
12,
9953,
1016,
15,
21,
16,
425,
4223,
3719,
262,
288,
203,
5411,
327,
629,
31,
203,
3639,
289,
203,
540,
203,
3639,
368,
1893,
326,
589,
1087,
203,
3639,
309,
261,
2020,
1016,
405,
300,
21,
262,
288,
203,
5411,
272,
4223,
273,
2020,
1016,
31,
203,
5411,
425,
4223,
273,
11150,
1016,
405,
300,
21,
692,
11150,
1016,
294,
609,
18,
2469,
5621,
203,
5411,
12423,
1016,
273,
300,
21,
31,
203,
5411,
364,
261,
509,
277,
273,
272,
4223,
31,
277,
411,
425,
4223,
31,
277,
9904,
262,
288,
203,
7734,
1149,
4513,
273,
609,
18,
3001,
861,
12,
77,
1769,
203,
7734,
309,
261,
25165,
17,
9548,
18,
31806,
12,
15182,
13,
405,
300,
21,
262,
288,
203,
10792,
309,
261,
12423,
1016,
422,
300,
21,
262,
288,
203,
13491,
12423,
1016,
273,
277,
31,
203,
13491,
1324,
31,
203,
10792,
289,
203,
5397,
203,
10792,
309,
261,
277,
300,
12423,
1016,
422,
404,
747,
261,
15182,
422,
2611,
597,
277,
422,
261,
73,
4223,
300,
404,
3719,
262,
288,
203,
13491,
327,
629,
31,
203,
10792,
289,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
866,
309,
326,
1269,
533,
353,
392,
1976,
1758,
578,
486,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
609,
203,
377,
380,
632,
891,
282,
11681,
3129,
3880,
733,
203,
377,
380,
632,
2463,
225,
1250,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
2925afa08b341cc127c3b722cd1b93e9cf96aea9 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/EntityFormat.java | [
"Apache-2.0"
] | Java | isMobileNumber | null | public static final boolean isMobileNumber(String str)
{
if ( str.length() != 11 ) {
return false;
}
if ( str.charAt(0) != '1' ) {
return false;
}
if ( "34578".indexOf(str.charAt(1)) == -1 ) {
return false;
}
return StringUtil.isNumeric(str, 2, str.length());
} | /**
* check if the specified string is a mobile number
*
* @param str
* @return boolean
*/ | check if the specified string is a mobile number
@param str
@return boolean | [
"check",
"if",
"the",
"specified",
"string",
"is",
"a",
"mobile",
"number",
"@param",
"str",
"@return",
"boolean"
] | public static final boolean isMobileNumber(String str)
{
if ( str.length() != 11 ) {
return false;
}
if ( str.charAt(0) != '1' ) {
return false;
}
if ( "34578".indexOf(str.charAt(1)) == -1 ) {
return false;
}
return StringUtil.isNumeric(str, 2, str.length());
} | [
"public",
"static",
"final",
"boolean",
"isMobileNumber",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
".",
"length",
"(",
")",
"!=",
"11",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"str",
".",
"charAt",
"(",
"0",
")",
"!=",
"'1'",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"\"34578\"",
".",
"indexOf",
"(",
"str",
".",
"charAt",
"(",
"1",
")",
")",
"==",
"-",
"1",
")",
"{",
"return",
"false",
";",
"}",
"return",
"StringUtil",
".",
"isNumeric",
"(",
"str",
",",
"2",
",",
"str",
".",
"length",
"(",
")",
")",
";",
"}"
] | check if the specified string is a mobile number | [
"check",
"if",
"the",
"specified",
"string",
"is",
"a",
"mobile",
"number"
] | [] | [
{
"param": "str",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
727,
1250,
15707,
7106,
1854,
12,
780,
609,
13,
203,
565,
288,
203,
3639,
309,
261,
609,
18,
2469,
1435,
480,
4648,
262,
288,
203,
5411,
327,
629,
31,
203,
3639,
289,
203,
540,
203,
3639,
309,
261,
609,
18,
3001,
861,
12,
20,
13,
480,
296,
21,
11,
262,
288,
203,
5411,
327,
629,
31,
203,
3639,
289,
203,
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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
866,
309,
326,
1269,
533,
353,
279,
13411,
1300,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
609,
203,
377,
380,
632,
2463,
225,
1250,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
2925afa08b341cc127c3b722cd1b93e9cf96aea9 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/EntityFormat.java | [
"Apache-2.0"
] | Java | ipPartCheck | null | private static final boolean ipPartCheck(
String str, int sIdx, int eIdx)
{
int len = eIdx - sIdx;
if ( len < 1 ) {
return false;
}
switch ( len ) {
case 1:
case 2:
if ( ! StringUtil.isNumeric(str, sIdx, eIdx) ) return false;
break;
case 3:
char chr1 = str.charAt(sIdx);
if ( chr1 == '1' ) {
if ( ! StringUtil.isNumeric(str, sIdx+1, eIdx) ) return false;
} else if ( chr1 == '2' ) {
char chr2 = str.charAt(sIdx+1);
if ( chr2 < '0' || chr2 > '5' ) return false;
char chr3 = str.charAt(sIdx+2); //the third numeric
if ( chr2 == '5' ) {
if ( chr3 < '0' || chr3 > '5' ) return false;
} else {
if ( chr3 < '0' || chr3 > '9' ) return false;
}
}
break;
default:
return false;
}
return true;
} | /**
* check if the specified string is a IPv4/v6 address
* v6 is not supported for now
*
* @param str
* @return boolean
*/ | check if the specified string is a IPv4/v6 address
v6 is not supported for now
@param str
@return boolean | [
"check",
"if",
"the",
"specified",
"string",
"is",
"a",
"IPv4",
"/",
"v6",
"address",
"v6",
"is",
"not",
"supported",
"for",
"now",
"@param",
"str",
"@return",
"boolean"
] | private static final boolean ipPartCheck(
String str, int sIdx, int eIdx)
{
int len = eIdx - sIdx;
if ( len < 1 ) {
return false;
}
switch ( len ) {
case 1:
case 2:
if ( ! StringUtil.isNumeric(str, sIdx, eIdx) ) return false;
break;
case 3:
char chr1 = str.charAt(sIdx);
if ( chr1 == '1' ) {
if ( ! StringUtil.isNumeric(str, sIdx+1, eIdx) ) return false;
} else if ( chr1 == '2' ) {
char chr2 = str.charAt(sIdx+1);
if ( chr2 < '0' || chr2 > '5' ) return false;
char chr3 = str.charAt(sIdx+2);
if ( chr2 == '5' ) {
if ( chr3 < '0' || chr3 > '5' ) return false;
} else {
if ( chr3 < '0' || chr3 > '9' ) return false;
}
}
break;
default:
return false;
}
return true;
} | [
"private",
"static",
"final",
"boolean",
"ipPartCheck",
"(",
"String",
"str",
",",
"int",
"sIdx",
",",
"int",
"eIdx",
")",
"{",
"int",
"len",
"=",
"eIdx",
"-",
"sIdx",
";",
"if",
"(",
"len",
"<",
"1",
")",
"{",
"return",
"false",
";",
"}",
"switch",
"(",
"len",
")",
"{",
"case",
"1",
":",
"case",
"2",
":",
"if",
"(",
"!",
"StringUtil",
".",
"isNumeric",
"(",
"str",
",",
"sIdx",
",",
"eIdx",
")",
")",
"return",
"false",
";",
"break",
";",
"case",
"3",
":",
"char",
"chr1",
"=",
"str",
".",
"charAt",
"(",
"sIdx",
")",
";",
"if",
"(",
"chr1",
"==",
"'1'",
")",
"{",
"if",
"(",
"!",
"StringUtil",
".",
"isNumeric",
"(",
"str",
",",
"sIdx",
"+",
"1",
",",
"eIdx",
")",
")",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"chr1",
"==",
"'2'",
")",
"{",
"char",
"chr2",
"=",
"str",
".",
"charAt",
"(",
"sIdx",
"+",
"1",
")",
";",
"if",
"(",
"chr2",
"<",
"'0'",
"||",
"chr2",
">",
"'5'",
")",
"return",
"false",
";",
"char",
"chr3",
"=",
"str",
".",
"charAt",
"(",
"sIdx",
"+",
"2",
")",
";",
"if",
"(",
"chr2",
"==",
"'5'",
")",
"{",
"if",
"(",
"chr3",
"<",
"'0'",
"||",
"chr3",
">",
"'5'",
")",
"return",
"false",
";",
"}",
"else",
"{",
"if",
"(",
"chr3",
"<",
"'0'",
"||",
"chr3",
">",
"'9'",
")",
"return",
"false",
";",
"}",
"}",
"break",
";",
"default",
":",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | check if the specified string is a IPv4/v6 address
v6 is not supported for now | [
"check",
"if",
"the",
"specified",
"string",
"is",
"a",
"IPv4",
"/",
"v6",
"address",
"v6",
"is",
"not",
"supported",
"for",
"now"
] | [
"//the third numeric"
] | [
{
"param": "str",
"type": "String"
},
{
"param": "sIdx",
"type": "int"
},
{
"param": "eIdx",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sIdx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "eIdx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
760,
727,
1250,
2359,
1988,
1564,
12,
203,
5411,
514,
609,
16,
509,
272,
4223,
16,
509,
425,
4223,
13,
7010,
565,
288,
203,
3639,
509,
562,
273,
425,
4223,
300,
272,
4223,
31,
203,
3639,
309,
261,
562,
411,
404,
262,
288,
203,
5411,
327,
629,
31,
203,
3639,
289,
203,
540,
203,
3639,
1620,
261,
562,
262,
288,
203,
3639,
648,
404,
30,
203,
3639,
648,
576,
30,
203,
5411,
309,
261,
401,
14205,
18,
291,
9902,
12,
701,
16,
272,
4223,
16,
425,
4223,
13,
262,
327,
629,
31,
203,
5411,
898,
31,
203,
3639,
648,
890,
30,
203,
5411,
1149,
4513,
21,
273,
609,
18,
3001,
861,
12,
87,
4223,
1769,
203,
5411,
309,
261,
4513,
21,
422,
296,
21,
11,
262,
288,
203,
7734,
309,
261,
401,
14205,
18,
291,
9902,
12,
701,
16,
272,
4223,
15,
21,
16,
425,
4223,
13,
262,
327,
629,
31,
203,
5411,
289,
469,
309,
261,
4513,
21,
422,
296,
22,
11,
262,
288,
203,
7734,
1149,
4513,
22,
273,
609,
18,
3001,
861,
12,
87,
4223,
15,
21,
1769,
203,
7734,
309,
261,
4513,
22,
411,
296,
20,
11,
747,
4513,
22,
405,
296,
25,
11,
262,
327,
629,
31,
203,
7734,
1149,
4513,
23,
273,
609,
18,
3001,
861,
12,
87,
4223,
15,
22,
1769,
282,
368,
5787,
12126,
6389,
203,
7734,
309,
261,
4513,
22,
422,
296,
25,
11,
262,
288,
203,
10792,
309,
261,
4513,
23,
411,
296,
20,
11,
747,
4513,
23,
405,
296,
25,
11,
262,
327,
629,
31,
203,
7734,
289,
469,
288,
203,
10792,
309,
261,
4513,
23,
411,
296,
20,
11,
747,
4513,
23,
405,
296,
29,
11,
262,
327,
629,
31,
203,
7734,
289,
203,
5411,
289,
203,
5411,
898,
31,
203,
3639,
805,
30,
203,
5411,
327,
629,
31,
203,
3639,
289,
203,
540,
203,
3639,
327,
638,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
866,
309,
326,
1269,
533,
353,
279,
7853,
24,
19,
90,
26,
1758,
203,
377,
380,
331,
26,
353,
486,
3260,
364,
2037,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
609,
203,
377,
380,
632,
2463,
225,
1250,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
977fb6a25f7c4dfcd2e195bdb6baef87e1fef830 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/segmenter/Segmenter.java | [
"Apache-2.0"
] | Java | readNext | null | protected int readNext() throws IOException
{
int c = reader.read();
if ( c != -1 ) idx++;
return c;
} | /**
* read the next char from the current position
*
* @throws IOException
*/ | read the next char from the current position
| [
"read",
"the",
"next",
"char",
"from",
"the",
"current",
"position"
] | protected int readNext() throws IOException
{
int c = reader.read();
if ( c != -1 ) idx++;
return c;
} | [
"protected",
"int",
"readNext",
"(",
")",
"throws",
"IOException",
"{",
"int",
"c",
"=",
"reader",
".",
"read",
"(",
")",
";",
"if",
"(",
"c",
"!=",
"-",
"1",
")",
"idx",
"++",
";",
"return",
"c",
";",
"}"
] | read the next char from the current position | [
"read",
"the",
"next",
"char",
"from",
"the",
"current",
"position"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
509,
855,
2134,
1435,
1216,
1860,
7010,
565,
288,
203,
3639,
509,
276,
273,
2949,
18,
896,
5621,
203,
3639,
309,
261,
276,
480,
300,
21,
262,
2067,
9904,
31,
203,
3639,
327,
276,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
855,
326,
1024,
1149,
628,
326,
783,
1754,
203,
377,
380,
7010,
377,
380,
632,
15069,
1860,
7010,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
977fb6a25f7c4dfcd2e195bdb6baef87e1fef830 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/segmenter/Segmenter.java | [
"Apache-2.0"
] | Java | appendCJKWordFeatures | null | protected void appendCJKWordFeatures( IWord word )
{
//add the pinyin to the pool
if ( config.APPEND_CJK_PINYIN
&& config.LOAD_CJK_PINYIN && word.getPinyin() != null ) {
SegKit.appendPinyin(config, wordPool, word);
}
//add the synonyms words to the pool
if ( config.APPEND_CJK_SYN
&& config.LOAD_CJK_SYN && word.getSyn() != null ) {
SegKit.appendSynonyms(config, wordPool, word);
}
} | /**
* check and append the pinyin and the synonyms words of the specified word
*
* @param word
*/ | check and append the pinyin and the synonyms words of the specified word
@param word | [
"check",
"and",
"append",
"the",
"pinyin",
"and",
"the",
"synonyms",
"words",
"of",
"the",
"specified",
"word",
"@param",
"word"
] | protected void appendCJKWordFeatures( IWord word )
{
if ( config.APPEND_CJK_PINYIN
&& config.LOAD_CJK_PINYIN && word.getPinyin() != null ) {
SegKit.appendPinyin(config, wordPool, word);
}
if ( config.APPEND_CJK_SYN
&& config.LOAD_CJK_SYN && word.getSyn() != null ) {
SegKit.appendSynonyms(config, wordPool, word);
}
} | [
"protected",
"void",
"appendCJKWordFeatures",
"(",
"IWord",
"word",
")",
"{",
"if",
"(",
"config",
".",
"APPEND_CJK_PINYIN",
"&&",
"config",
".",
"LOAD_CJK_PINYIN",
"&&",
"word",
".",
"getPinyin",
"(",
")",
"!=",
"null",
")",
"{",
"SegKit",
".",
"appendPinyin",
"(",
"config",
",",
"wordPool",
",",
"word",
")",
";",
"}",
"if",
"(",
"config",
".",
"APPEND_CJK_SYN",
"&&",
"config",
".",
"LOAD_CJK_SYN",
"&&",
"word",
".",
"getSyn",
"(",
")",
"!=",
"null",
")",
"{",
"SegKit",
".",
"appendSynonyms",
"(",
"config",
",",
"wordPool",
",",
"word",
")",
";",
"}",
"}"
] | check and append the pinyin and the synonyms words of the specified word | [
"check",
"and",
"append",
"the",
"pinyin",
"and",
"the",
"synonyms",
"words",
"of",
"the",
"specified",
"word"
] | [
"//add the pinyin to the pool",
"//add the synonyms words to the pool"
] | [
{
"param": "word",
"type": "IWord"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "word",
"type": "IWord",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
714,
39,
19474,
3944,
8696,
12,
467,
3944,
2076,
262,
203,
565,
288,
203,
3639,
368,
1289,
326,
7092,
93,
267,
358,
326,
2845,
203,
3639,
309,
261,
642,
18,
24176,
67,
39,
19474,
67,
52,
31853,
706,
7010,
7734,
597,
642,
18,
7783,
67,
39,
19474,
67,
52,
31853,
706,
597,
2076,
18,
588,
52,
11652,
267,
1435,
480,
446,
262,
288,
203,
540,
202,
3289,
14102,
18,
6923,
52,
11652,
267,
12,
1425,
16,
2076,
2864,
16,
2076,
1769,
203,
3639,
289,
203,
540,
203,
3639,
368,
1289,
326,
27260,
4511,
358,
326,
2845,
203,
3639,
309,
261,
642,
18,
24176,
67,
39,
19474,
67,
7474,
50,
7010,
7734,
597,
642,
18,
7783,
67,
39,
19474,
67,
7474,
50,
597,
2076,
18,
588,
10503,
1435,
480,
446,
262,
288,
203,
5411,
348,
1332,
14102,
18,
6923,
10503,
16968,
12,
1425,
16,
2076,
2864,
16,
2076,
1769,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
866,
471,
714,
326,
7092,
93,
267,
471,
326,
27260,
4511,
434,
326,
1269,
2076,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
2076,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
977fb6a25f7c4dfcd2e195bdb6baef87e1fef830 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/segmenter/Segmenter.java | [
"Apache-2.0"
] | Java | appendLatinWordFeatures | null | protected void appendLatinWordFeatures( IWord w )
{
IWord ew, t;
boolean append_syn = (config.LOAD_CJK_SYN && config.APPEND_CJK_SYN);
boolean append_pinyin = (config.LOAD_CJK_PINYIN && config.APPEND_CJK_PINYIN);
if ( (append_syn && w.getSyn() == null)
&& (append_pinyin && w.getPinyin() == null) ) {
/*
* @added 2014-07-07
* w maybe EC_MIX_WORD, so check its syn first
* and make sure it is not a EC_MIX_WORD then check the EN_WORD
*/
ew = (t = dic.get(ILexicon.CJK_WORD, w.getValue())) == null ? w : t;
} else {
ew = w;
}
ew.setPosition(w.getPosition());
if ( append_syn && ew.getSyn() != null ) {
SegKit.appendSynonyms(config, wordPool, ew);
}
if ( append_pinyin && ew.getPinyin() != null ) {
SegKit.appendPinyin(config, wordPool, ew);
}
} | /**
* Check and append the synonyms/pinyin words of specified word included the CJK and basic Latin words
* All the synonyms words share the same position part of speech, word type with the primitive word
*
* @param w
*/ | Check and append the synonyms/pinyin words of specified word included the CJK and basic Latin words
All the synonyms words share the same position part of speech, word type with the primitive word
@param w | [
"Check",
"and",
"append",
"the",
"synonyms",
"/",
"pinyin",
"words",
"of",
"specified",
"word",
"included",
"the",
"CJK",
"and",
"basic",
"Latin",
"words",
"All",
"the",
"synonyms",
"words",
"share",
"the",
"same",
"position",
"part",
"of",
"speech",
"word",
"type",
"with",
"the",
"primitive",
"word",
"@param",
"w"
] | protected void appendLatinWordFeatures( IWord w )
{
IWord ew, t;
boolean append_syn = (config.LOAD_CJK_SYN && config.APPEND_CJK_SYN);
boolean append_pinyin = (config.LOAD_CJK_PINYIN && config.APPEND_CJK_PINYIN);
if ( (append_syn && w.getSyn() == null)
&& (append_pinyin && w.getPinyin() == null) ) {
/*
* @added 2014-07-07
* w maybe EC_MIX_WORD, so check its syn first
* and make sure it is not a EC_MIX_WORD then check the EN_WORD
*/
ew = (t = dic.get(ILexicon.CJK_WORD, w.getValue())) == null ? w : t;
} else {
ew = w;
}
ew.setPosition(w.getPosition());
if ( append_syn && ew.getSyn() != null ) {
SegKit.appendSynonyms(config, wordPool, ew);
}
if ( append_pinyin && ew.getPinyin() != null ) {
SegKit.appendPinyin(config, wordPool, ew);
}
} | [
"protected",
"void",
"appendLatinWordFeatures",
"(",
"IWord",
"w",
")",
"{",
"IWord",
"ew",
",",
"t",
";",
"boolean",
"append_syn",
"=",
"(",
"config",
".",
"LOAD_CJK_SYN",
"&&",
"config",
".",
"APPEND_CJK_SYN",
")",
";",
"boolean",
"append_pinyin",
"=",
"(",
"config",
".",
"LOAD_CJK_PINYIN",
"&&",
"config",
".",
"APPEND_CJK_PINYIN",
")",
";",
"if",
"(",
"(",
"append_syn",
"&&",
"w",
".",
"getSyn",
"(",
")",
"==",
"null",
")",
"&&",
"(",
"append_pinyin",
"&&",
"w",
".",
"getPinyin",
"(",
")",
"==",
"null",
")",
")",
"{",
"/*\n * @added 2014-07-07\n * w maybe EC_MIX_WORD, so check its syn first\n * and make sure it is not a EC_MIX_WORD then check the EN_WORD \n */",
"ew",
"=",
"(",
"t",
"=",
"dic",
".",
"get",
"(",
"ILexicon",
".",
"CJK_WORD",
",",
"w",
".",
"getValue",
"(",
")",
")",
")",
"==",
"null",
"?",
"w",
":",
"t",
";",
"}",
"else",
"{",
"ew",
"=",
"w",
";",
"}",
"ew",
".",
"setPosition",
"(",
"w",
".",
"getPosition",
"(",
")",
")",
";",
"if",
"(",
"append_syn",
"&&",
"ew",
".",
"getSyn",
"(",
")",
"!=",
"null",
")",
"{",
"SegKit",
".",
"appendSynonyms",
"(",
"config",
",",
"wordPool",
",",
"ew",
")",
";",
"}",
"if",
"(",
"append_pinyin",
"&&",
"ew",
".",
"getPinyin",
"(",
")",
"!=",
"null",
")",
"{",
"SegKit",
".",
"appendPinyin",
"(",
"config",
",",
"wordPool",
",",
"ew",
")",
";",
"}",
"}"
] | Check and append the synonyms/pinyin words of specified word included the CJK and basic Latin words
All the synonyms words share the same position part of speech, word type with the primitive word | [
"Check",
"and",
"append",
"the",
"synonyms",
"/",
"pinyin",
"words",
"of",
"specified",
"word",
"included",
"the",
"CJK",
"and",
"basic",
"Latin",
"words",
"All",
"the",
"synonyms",
"words",
"share",
"the",
"same",
"position",
"part",
"of",
"speech",
"word",
"type",
"with",
"the",
"primitive",
"word"
] | [] | [
{
"param": "w",
"type": "IWord"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "w",
"type": "IWord",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
714,
6607,
267,
3944,
8696,
12,
467,
3944,
341,
262,
203,
565,
288,
203,
3639,
467,
3944,
22722,
16,
268,
31,
203,
3639,
1250,
714,
67,
11982,
273,
261,
1425,
18,
7783,
67,
39,
19474,
67,
7474,
50,
597,
642,
18,
24176,
67,
39,
19474,
67,
7474,
50,
1769,
203,
3639,
1250,
714,
67,
84,
11652,
267,
273,
261,
1425,
18,
7783,
67,
39,
19474,
67,
52,
31853,
706,
597,
642,
18,
24176,
67,
39,
19474,
67,
52,
31853,
706,
1769,
203,
3639,
309,
261,
261,
6923,
67,
11982,
597,
341,
18,
588,
10503,
1435,
422,
446,
13,
7010,
540,
202,
202,
10,
10,
261,
6923,
67,
84,
11652,
267,
597,
341,
18,
588,
52,
11652,
267,
1435,
422,
446,
13,
262,
288,
203,
540,
202,
20308,
203,
2398,
380,
632,
9665,
13695,
17,
8642,
17,
8642,
203,
2398,
380,
341,
6944,
7773,
67,
7492,
60,
67,
7952,
16,
1427,
866,
2097,
6194,
1122,
203,
2398,
380,
471,
1221,
3071,
518,
353,
486,
279,
7773,
67,
7492,
60,
67,
7952,
1508,
866,
326,
6693,
67,
7952,
7010,
5411,
1195,
203,
540,
202,
359,
273,
261,
88,
273,
11681,
18,
588,
12,
2627,
338,
3950,
18,
39,
19474,
67,
7952,
16,
341,
18,
24805,
1435,
3719,
422,
446,
692,
341,
294,
268,
31,
203,
3639,
289,
469,
288,
203,
540,
202,
359,
273,
341,
31,
203,
3639,
289,
203,
540,
203,
3639,
22722,
18,
542,
2555,
12,
91,
18,
588,
2555,
10663,
203,
3639,
309,
261,
714,
67,
11982,
597,
22722,
18,
588,
10503,
1435,
480,
446,
262,
288,
203,
377,
202,
202,
3289,
14102,
18,
6923,
10503,
16968,
12,
1425,
16,
2076,
2864,
16,
22722,
1769,
203,
3639,
289,
203,
3639,
309,
261,
714,
67,
84,
11652,
267,
597,
22722,
18,
588,
52,
11652,
267,
1435,
480,
446,
262,
288,
203,
377,
202,
202,
3289,
14102,
18,
6923,
52,
11652,
267,
12,
1425,
16,
2076,
2864,
16,
22722,
1769,
203,
377,
202,
97,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2073,
471,
714,
326,
27260,
19,
84,
11652,
267,
4511,
434,
1269,
2076,
5849,
326,
385,
19474,
471,
5337,
11134,
267,
4511,
203,
377,
380,
4826,
326,
27260,
4511,
7433,
326,
1967,
1754,
1087,
434,
24556,
16,
2076,
618,
598,
326,
8225,
2076,
203,
377,
380,
7010,
377,
380,
632,
891,
341,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
977fb6a25f7c4dfcd2e195bdb6baef87e1fef830 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/segmenter/Segmenter.java | [
"Apache-2.0"
] | Java | enSecondSeg | null | protected LinkedList<IWord> enSecondSeg( IWord w, LinkedList<IWord> wList )
{
char[] chars = w.getValue().toCharArray();
int _TYPE, _ctype, j, pos = w.getPosition();
IWord tw = null;
String _str = null;
/* check and create the sub word token buffer */
if ( wList == null ) {
wList = new LinkedList<IWord>();
}
/* check and keep the original Latin word */
if ( config.isKeepEnSecOriginalWord() ) {
wList.add(w);
}
for ( j = 0; j < chars.length; ) {
/* get the char type.
* It could only be one of EN_LETTER, EN_NUMERIC, EN_PUNCTUATION. */
_TYPE = StringUtil.getEnCharType(chars[j]);
if ( _TYPE == StringUtil.EN_PUNCTUATION ) {
tw = new Word(String.valueOf(chars[j]), IWord.T_PUNCTUATION);
tw.setPartSpeechForNull(IWord.PUNCTUATION);
tw.setPosition(pos + j);
j++;
continue;
}
isb.clear().append(chars[j]);
for ( int i = j + 1; i < chars.length; i++ ) {
_ctype = StringUtil.getEnCharType(chars[i]);
if ( _ctype != _TYPE ) {
break;
}
isb.append(chars[i]);
}
/* If the number of chars is larger than
* config.EN_SEC_MIN_LEN we create a new IWord
* and add to the wordPool.
*/
if ( isb.length() >= config.EN_SEC_MIN_LEN ) {
_str = isb.toString();
if ( ! ( config.CLEAR_STOPWORD && dic.match(ILexicon.STOP_WORD, _str) ) ) {
tw = new Word(_str, w.getType());
tw.setPartSpeechForNull(w.getPartSpeech());
tw.setPosition(pos + j);
/* check and do the English word segmentation */
if ( config.EN_WORD_SEG && _TYPE == StringUtil.EN_LETTER ) {
enWordSeg(tw, wList);
} else {
wList.addLast(tw);
}
}
}
j += isb.length();
}
chars = null; //Let gc do its work.
return wList;
} | /**
* <p>
* Do the secondary split for the specified complex Latin word
* This will split a complex English, Arabic, punctuation compose word to multiple simple parts
* Like 'qq2013' will split to 'qq' and '2013'
* </p>
*
* <p>
* And all the sub words share the same type and part of speech with the primitive word
* You should check the config.EN_SECOND_SEG before invoke this method
* </p>
*
* @param w
* @param wList
* @return LinkedList<IWord> all the sub word tokens
*/ |
And all the sub words share the same type and part of speech with the primitive word
You should check the config.EN_SECOND_SEG before invoke this method
@param w
@param wList
@return LinkedList all the sub word tokens | [
"And",
"all",
"the",
"sub",
"words",
"share",
"the",
"same",
"type",
"and",
"part",
"of",
"speech",
"with",
"the",
"primitive",
"word",
"You",
"should",
"check",
"the",
"config",
".",
"EN_SECOND_SEG",
"before",
"invoke",
"this",
"method",
"@param",
"w",
"@param",
"wList",
"@return",
"LinkedList",
"all",
"the",
"sub",
"word",
"tokens"
] | protected LinkedList<IWord> enSecondSeg( IWord w, LinkedList<IWord> wList )
{
char[] chars = w.getValue().toCharArray();
int _TYPE, _ctype, j, pos = w.getPosition();
IWord tw = null;
String _str = null;
/* check and create the sub word token buffer */
if ( wList == null ) {
wList = new LinkedList<IWord>();
}
/* check and keep the original Latin word */
if ( config.isKeepEnSecOriginalWord() ) {
wList.add(w);
}
for ( j = 0; j < chars.length; ) {
/* get the char type.
* It could only be one of EN_LETTER, EN_NUMERIC, EN_PUNCTUATION. */
_TYPE = StringUtil.getEnCharType(chars[j]);
if ( _TYPE == StringUtil.EN_PUNCTUATION ) {
tw = new Word(String.valueOf(chars[j]), IWord.T_PUNCTUATION);
tw.setPartSpeechForNull(IWord.PUNCTUATION);
tw.setPosition(pos + j);
j++;
continue;
}
isb.clear().append(chars[j]);
for ( int i = j + 1; i < chars.length; i++ ) {
_ctype = StringUtil.getEnCharType(chars[i]);
if ( _ctype != _TYPE ) {
break;
}
isb.append(chars[i]);
}
/* If the number of chars is larger than
* config.EN_SEC_MIN_LEN we create a new IWord
* and add to the wordPool.
*/
if ( isb.length() >= config.EN_SEC_MIN_LEN ) {
_str = isb.toString();
if ( ! ( config.CLEAR_STOPWORD && dic.match(ILexicon.STOP_WORD, _str) ) ) {
tw = new Word(_str, w.getType());
tw.setPartSpeechForNull(w.getPartSpeech());
tw.setPosition(pos + j);
/* check and do the English word segmentation */
if ( config.EN_WORD_SEG && _TYPE == StringUtil.EN_LETTER ) {
enWordSeg(tw, wList);
} else {
wList.addLast(tw);
}
}
}
j += isb.length();
}
chars = null;
return wList;
} | [
"protected",
"LinkedList",
"<",
"IWord",
">",
"enSecondSeg",
"(",
"IWord",
"w",
",",
"LinkedList",
"<",
"IWord",
">",
"wList",
")",
"{",
"char",
"[",
"]",
"chars",
"=",
"w",
".",
"getValue",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"int",
"_TYPE",
",",
"_ctype",
",",
"j",
",",
"pos",
"=",
"w",
".",
"getPosition",
"(",
")",
";",
"IWord",
"tw",
"=",
"null",
";",
"String",
"_str",
"=",
"null",
";",
"/* check and create the sub word token buffer */",
"if",
"(",
"wList",
"==",
"null",
")",
"{",
"wList",
"=",
"new",
"LinkedList",
"<",
"IWord",
">",
"(",
")",
";",
"}",
"/* check and keep the original Latin word */",
"if",
"(",
"config",
".",
"isKeepEnSecOriginalWord",
"(",
")",
")",
"{",
"wList",
".",
"add",
"(",
"w",
")",
";",
"}",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"chars",
".",
"length",
";",
")",
"{",
"/* get the char type.\n * It could only be one of EN_LETTER, EN_NUMERIC, EN_PUNCTUATION. */",
"_TYPE",
"=",
"StringUtil",
".",
"getEnCharType",
"(",
"chars",
"[",
"j",
"]",
")",
";",
"if",
"(",
"_TYPE",
"==",
"StringUtil",
".",
"EN_PUNCTUATION",
")",
"{",
"tw",
"=",
"new",
"Word",
"(",
"String",
".",
"valueOf",
"(",
"chars",
"[",
"j",
"]",
")",
",",
"IWord",
".",
"T_PUNCTUATION",
")",
";",
"tw",
".",
"setPartSpeechForNull",
"(",
"IWord",
".",
"PUNCTUATION",
")",
";",
"tw",
".",
"setPosition",
"(",
"pos",
"+",
"j",
")",
";",
"j",
"++",
";",
"continue",
";",
"}",
"isb",
".",
"clear",
"(",
")",
".",
"append",
"(",
"chars",
"[",
"j",
"]",
")",
";",
"for",
"(",
"int",
"i",
"=",
"j",
"+",
"1",
";",
"i",
"<",
"chars",
".",
"length",
";",
"i",
"++",
")",
"{",
"_ctype",
"=",
"StringUtil",
".",
"getEnCharType",
"(",
"chars",
"[",
"i",
"]",
")",
";",
"if",
"(",
"_ctype",
"!=",
"_TYPE",
")",
"{",
"break",
";",
"}",
"isb",
".",
"append",
"(",
"chars",
"[",
"i",
"]",
")",
";",
"}",
"/* If the number of chars is larger than\n * config.EN_SEC_MIN_LEN we create a new IWord\n * and add to the wordPool.\n */",
"if",
"(",
"isb",
".",
"length",
"(",
")",
">=",
"config",
".",
"EN_SEC_MIN_LEN",
")",
"{",
"_str",
"=",
"isb",
".",
"toString",
"(",
")",
";",
"if",
"(",
"!",
"(",
"config",
".",
"CLEAR_STOPWORD",
"&&",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"STOP_WORD",
",",
"_str",
")",
")",
")",
"{",
"tw",
"=",
"new",
"Word",
"(",
"_str",
",",
"w",
".",
"getType",
"(",
")",
")",
";",
"tw",
".",
"setPartSpeechForNull",
"(",
"w",
".",
"getPartSpeech",
"(",
")",
")",
";",
"tw",
".",
"setPosition",
"(",
"pos",
"+",
"j",
")",
";",
"/* check and do the English word segmentation */",
"if",
"(",
"config",
".",
"EN_WORD_SEG",
"&&",
"_TYPE",
"==",
"StringUtil",
".",
"EN_LETTER",
")",
"{",
"enWordSeg",
"(",
"tw",
",",
"wList",
")",
";",
"}",
"else",
"{",
"wList",
".",
"addLast",
"(",
"tw",
")",
";",
"}",
"}",
"}",
"j",
"+=",
"isb",
".",
"length",
"(",
")",
";",
"}",
"chars",
"=",
"null",
";",
"return",
"wList",
";",
"}"
] | <p>
Do the secondary split for the specified complex Latin word
This will split a complex English, Arabic, punctuation compose word to multiple simple parts
Like 'qq2013' will split to 'qq' and '2013'
</p> | [
"<p",
">",
"Do",
"the",
"secondary",
"split",
"for",
"the",
"specified",
"complex",
"Latin",
"word",
"This",
"will",
"split",
"a",
"complex",
"English",
"Arabic",
"punctuation",
"compose",
"word",
"to",
"multiple",
"simple",
"parts",
"Like",
"'",
"qq2013",
"'",
"will",
"split",
"to",
"'",
"qq",
"'",
"and",
"'",
"2013",
"'",
"<",
"/",
"p",
">"
] | [
"//Let gc do its work."
] | [
{
"param": "w",
"type": "IWord"
},
{
"param": "wList",
"type": "LinkedList<IWord>"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "w",
"type": "IWord",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wList",
"type": "LinkedList<IWord>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
10688,
32,
45,
3944,
34,
570,
8211,
3289,
12,
467,
3944,
341,
16,
10688,
32,
45,
3944,
34,
341,
682,
262,
7010,
565,
288,
203,
3639,
1149,
8526,
5230,
273,
341,
18,
24805,
7675,
869,
15936,
5621,
203,
3639,
509,
389,
2399,
16,
389,
12387,
16,
525,
16,
949,
273,
341,
18,
588,
2555,
5621,
203,
3639,
467,
3944,
2339,
273,
446,
31,
203,
3639,
514,
389,
701,
273,
446,
31,
203,
540,
203,
3639,
1748,
866,
471,
752,
326,
720,
2076,
1147,
1613,
1195,
203,
3639,
309,
261,
341,
682,
422,
446,
262,
288,
203,
540,
202,
91,
682,
273,
394,
10688,
32,
45,
3944,
34,
5621,
203,
3639,
289,
203,
540,
203,
3639,
1748,
866,
471,
3455,
326,
2282,
11134,
267,
2076,
1195,
203,
3639,
309,
261,
642,
18,
291,
11523,
664,
2194,
8176,
3944,
1435,
262,
288,
203,
540,
202,
91,
682,
18,
1289,
12,
91,
1769,
203,
3639,
289,
203,
540,
203,
3639,
364,
261,
225,
525,
273,
374,
31,
525,
411,
5230,
18,
2469,
31,
262,
288,
203,
540,
202,
20308,
336,
326,
1149,
618,
18,
203,
2398,
380,
2597,
3377,
1338,
506,
1245,
434,
6693,
67,
26379,
16,
6693,
67,
22998,
16,
6693,
67,
52,
2124,
1268,
57,
2689,
18,
1195,
203,
540,
202,
67,
2399,
273,
14205,
18,
588,
664,
2156,
559,
12,
7549,
63,
78,
19226,
203,
540,
202,
430,
261,
389,
2399,
422,
14205,
18,
1157,
67,
52,
2124,
1268,
57,
2689,
262,
288,
203,
540,
202,
202,
11246,
273,
394,
9926,
12,
780,
18,
1132,
951,
12,
7549,
63,
78,
65,
3631,
467,
3944,
18,
56,
67,
52,
2124,
1268,
57,
2689,
1769,
203,
2398,
202,
11246,
18,
542,
1988,
22334,
1290,
2041,
12,
45,
3944,
18,
52,
2124,
1268,
57,
2689,
1769,
203,
2398,
202,
11246,
18,
542,
2555,
12,
917,
397,
525,
1769,
203,
2398,
202,
78,
9904,
31,
203,
540,
202,
202,
17143,
31,
203,
540,
202,
97,
203,
540,
202,
203,
5411,
353,
70,
18,
8507,
7675,
6923,
12,
7549,
63,
78,
19226,
203,
5411,
364,
261,
509,
277,
273,
525,
397,
404,
31,
277,
411,
5230,
18,
2469,
31,
277,
9904,
262,
288,
203,
2398,
202,
67,
12387,
273,
14205,
18,
588,
664,
2156,
559,
12,
7549,
63,
77,
19226,
203,
2398,
202,
430,
261,
389,
12387,
480,
389,
2399,
262,
288,
203,
2398,
202,
202,
8820,
31,
203,
2398,
202,
97,
203,
2398,
202,
291,
70,
18,
6923,
12,
7549,
63,
77,
19226,
203,
5411,
289,
203,
2398,
203,
5411,
1748,
971,
326,
1300,
434,
5230,
353,
10974,
2353,
203,
2398,
380,
225,
642,
18,
1157,
67,
11944,
67,
6236,
67,
13017,
732,
752,
279,
394,
467,
3944,
203,
2398,
380,
471,
527,
358,
326,
2076,
2864,
18,
203,
5411,
1195,
203,
5411,
309,
261,
353,
70,
18,
2469,
1435,
1545,
642,
18,
1157,
67,
11944,
67,
6236,
67,
13017,
262,
288,
203,
7734,
389,
701,
273,
353,
70,
18,
10492,
5621,
203,
7734,
309,
261,
401,
261,
642,
18,
23181,
985,
67,
17513,
7952,
597,
11681,
18,
1916,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
411,
84,
34,
203,
377,
380,
2256,
326,
9946,
1416,
364,
326,
1269,
7233,
11134,
267,
2076,
203,
377,
380,
1220,
903,
1416,
279,
7233,
24151,
16,
432,
20727,
335,
16,
22472,
11458,
2076,
358,
3229,
4143,
2140,
203,
377,
380,
23078,
296,
11961,
6734,
23,
11,
903,
1416,
358,
296,
11961,
11,
471,
296,
6734,
23,
11,
203,
377,
380,
7765,
84,
34,
203,
377,
380,
7010,
377,
380,
411,
84,
34,
203,
377,
380,
7835,
777,
326,
720,
4511,
7433,
326,
1967,
618,
471,
1087,
434,
24556,
598,
326,
8225,
2076,
203,
377,
380,
4554,
1410,
866,
326,
642,
18,
1157,
67,
16328,
67,
1090,
43,
1865,
4356,
333,
707,
203,
377,
380,
7765,
84,
34,
203,
377,
380,
7010,
2
] |
977fb6a25f7c4dfcd2e195bdb6baef87e1fef830 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/segmenter/Segmenter.java | [
"Apache-2.0"
] | Java | enWordSeg | null | protected LinkedList<IWord> enWordSeg(IWord w, LinkedList<IWord> wList)
{
final char[] chars = w.getValue().toCharArray();
IChunk chunk = null;
IWord word = null;
int index = 0, pos = w.getPosition();
while ( index < chars.length ) {
chunk = getBestChunk(chars, index, config.EN_MAX_LEN);
// word = chunk.getWords()[0];
word = chunk.getWords()[0].clone();
word.setPosition(pos+index);
wList.add(word);
index += word.getValue().length();
}
return wList;
} | /**
* Latin word lexicon based English word segmentation.
*
* @param w
* @param wList
* @return LinkedList<IWord> all the sub word tokens
*/ | Latin word lexicon based English word segmentation.
@param w
@param wList
@return LinkedList all the sub word tokens | [
"Latin",
"word",
"lexicon",
"based",
"English",
"word",
"segmentation",
".",
"@param",
"w",
"@param",
"wList",
"@return",
"LinkedList",
"all",
"the",
"sub",
"word",
"tokens"
] | protected LinkedList<IWord> enWordSeg(IWord w, LinkedList<IWord> wList)
{
final char[] chars = w.getValue().toCharArray();
IChunk chunk = null;
IWord word = null;
int index = 0, pos = w.getPosition();
while ( index < chars.length ) {
chunk = getBestChunk(chars, index, config.EN_MAX_LEN);
word = chunk.getWords()[0].clone();
word.setPosition(pos+index);
wList.add(word);
index += word.getValue().length();
}
return wList;
} | [
"protected",
"LinkedList",
"<",
"IWord",
">",
"enWordSeg",
"(",
"IWord",
"w",
",",
"LinkedList",
"<",
"IWord",
">",
"wList",
")",
"{",
"final",
"char",
"[",
"]",
"chars",
"=",
"w",
".",
"getValue",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"IChunk",
"chunk",
"=",
"null",
";",
"IWord",
"word",
"=",
"null",
";",
"int",
"index",
"=",
"0",
",",
"pos",
"=",
"w",
".",
"getPosition",
"(",
")",
";",
"while",
"(",
"index",
"<",
"chars",
".",
"length",
")",
"{",
"chunk",
"=",
"getBestChunk",
"(",
"chars",
",",
"index",
",",
"config",
".",
"EN_MAX_LEN",
")",
";",
"word",
"=",
"chunk",
".",
"getWords",
"(",
")",
"[",
"0",
"]",
".",
"clone",
"(",
")",
";",
"word",
".",
"setPosition",
"(",
"pos",
"+",
"index",
")",
";",
"wList",
".",
"add",
"(",
"word",
")",
";",
"index",
"+=",
"word",
".",
"getValue",
"(",
")",
".",
"length",
"(",
")",
";",
"}",
"return",
"wList",
";",
"}"
] | Latin word lexicon based English word segmentation. | [
"Latin",
"word",
"lexicon",
"based",
"English",
"word",
"segmentation",
"."
] | [
"// word = chunk.getWords()[0];"
] | [
{
"param": "w",
"type": "IWord"
},
{
"param": "wList",
"type": "LinkedList<IWord>"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "w",
"type": "IWord",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wList",
"type": "LinkedList<IWord>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
10688,
32,
45,
3944,
34,
570,
3944,
3289,
12,
45,
3944,
341,
16,
10688,
32,
45,
3944,
34,
341,
682,
13,
7010,
565,
288,
203,
377,
202,
6385,
1149,
8526,
5230,
273,
341,
18,
24805,
7675,
869,
15936,
5621,
203,
377,
202,
45,
5579,
2441,
273,
446,
31,
203,
377,
202,
45,
3944,
2076,
273,
446,
31,
203,
377,
202,
203,
377,
202,
474,
770,
273,
374,
16,
949,
273,
341,
18,
588,
2555,
5621,
203,
377,
202,
17523,
261,
770,
411,
5230,
18,
2469,
262,
288,
203,
377,
202,
202,
6551,
273,
28782,
5579,
12,
7549,
16,
770,
16,
642,
18,
1157,
67,
6694,
67,
13017,
1769,
203,
377,
202,
202,
759,
2076,
273,
2441,
18,
588,
7363,
1435,
63,
20,
15533,
203,
377,
202,
202,
1095,
273,
2441,
18,
588,
7363,
1435,
63,
20,
8009,
14056,
5621,
203,
1082,
202,
1095,
18,
542,
2555,
12,
917,
15,
1615,
1769,
203,
377,
202,
202,
91,
682,
18,
1289,
12,
1095,
1769,
203,
377,
202,
202,
1615,
1011,
2076,
18,
24805,
7675,
2469,
5621,
203,
377,
202,
97,
203,
377,
202,
203,
377,
202,
2463,
341,
682,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
11134,
267,
2076,
31681,
2511,
24151,
2076,
25192,
18,
203,
377,
380,
7010,
377,
380,
632,
891,
202,
91,
203,
377,
380,
632,
891,
202,
91,
682,
203,
377,
380,
632,
2463,
202,
13174,
682,
32,
45,
3944,
34,
777,
326,
720,
2076,
2430,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
977fb6a25f7c4dfcd2e195bdb6baef87e1fef830 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/segmenter/Segmenter.java | [
"Apache-2.0"
] | Java | findCHName | String | protected String findCHName( char[] chars, int index, IChunk chunk )
{
StringBuilder isb = new StringBuilder();
//isb.clear();
/*there is only two IWords in the chunk. */
if ( chunk.getWords().length == 2 ) {
IWord w = chunk.getWords()[1];
switch ( w.getLength() ) {
case 1:
if ( dic.match(ILexicon.CN_SNAME, w.getValue()) ) {
isb.append(w.getValue());
return isb.toString();
}
return null;
case 2:
case 3:
/*
* there is only two IWords in the chunk.
* case 2:
* like: 这本书是陈高的, chunk: 陈_高的
* more: 瓜子和坚果,chunk: 和_坚果 (1.6.8前版本有歧义)
* case 3:
* 1.double name: the two chars and char after it make up a word.
* like: 这本书是陈美丽的, chunk: 陈_美丽的
* 2.single name: the char and the two chars after it make up a word. -ignore
*/
String d1 = new String(w.getValue().charAt(0)+"");
String d2 = new String(w.getValue().charAt(1)+"");
if ( dic.match(ILexicon.CN_DNAME_1, d1)
&& dic.match(ILexicon.CN_DNAME_2, d2)) {
isb.append(d1);
isb.append(d2);
return isb.toString();
}
/*
* the name char of the single name and the char after it
* make up a word.
*/
else if ( dic.match(ILexicon.CN_SNAME, d1) ) {
IWord iw = dic.get(ILexicon.CJK_WORD, d2);
if ( iw != null && iw.getFrequency() >= config.NAME_SINGLE_THRESHOLD ) {
isb.append(d1);
return isb.toString();
}
}
return null;
}
} else {
/*three IWords in the chunk */
IWord w1 = chunk.getWords()[1];
IWord w2 = chunk.getWords()[2];
switch ( w1.getLength() ) {
case 1:
/*check if it is a double name first.*/
if ( dic.match(ILexicon.CN_DNAME_1, w1.getValue()) ) {
if ( w2.getLength() == 1 ) {
/*real double name?*/
if ( dic.match(ILexicon.CN_DNAME_2, w2.getValue()) ) {
isb.append(w1.getValue());
isb.append(w2.getValue());
return isb.toString();
}
/*not a real double name, check if it is a single name.*/
else if ( dic.match(ILexicon.CN_SNAME, w1.getValue()) ) {
isb.append(w1.getValue());
return isb.toString();
}
}
/*
* double name:
* char 2 and the char after it make up a word.
* like: 陈志高兴奋极了, chunk:陈_志_高兴 (兴和后面成词)
* like: 陈志高的, chunk:陈_志_高的 ("的"的阕值Config.SINGLE_THRESHOLD)
* like: 陈高兴奋极了, chunk:陈_高_兴奋 (single name)
*/
else {
String d1 = new String(w2.getValue().charAt(0)+"");
int index_ = index + chunk.getWords()[0].getLength() + 2;
IWord[] ws = getNextMatch(config.MAX_LENGTH, chars, index_, null);
//System.out.println("index:"+index+":"+chars[index]+", "+ws[0]);
/*is it a double name?*/
if ( dic.match(ILexicon.CN_DNAME_2, d1) &&
(ws.length > 1 || ws[0].getFrequency() >= config.NAME_SINGLE_THRESHOLD)) {
isb.append(w1.getValue());
isb.append(d1);
return isb.toString();
}
/*check if it is a single name*/
else if ( dic.match(ILexicon.CN_SNAME, w1.getValue()) ) {
isb.append(w1.getValue());
return isb.toString();
}
}
}
/*check if it is a single name.*/
else if ( dic.match(ILexicon.CN_SNAME, w1.getValue()) ) {
isb.append(w1.getValue());
return isb.toString();
}
return null;
case 2:
String d1 = new String(w1.getValue().charAt(0)+"");
String d2 = new String(w1.getValue().charAt(1)+"");
/*
* it is a double name and char 1, char 2 make up a word.
* like: 陈美丽是对的, chunk: 陈_美丽_是
* more: 都成为高速公路, chunk:都_成为_高速公路 (1.6.8以前的有歧义)
*/
if ( dic.match(ILexicon.CN_DNAME_1, d1)
&& dic.match(ILexicon.CN_DNAME_2, d2)) {
isb.append(w1.getValue());
return isb.toString();
}
/*
* it is a single name, char 1 and the char after it make up a word.
*/
else if ( dic.match(ILexicon.CN_SNAME, d1) ) {
IWord iw = dic.get(ILexicon.CJK_WORD, d2);
if ( iw != null && iw.getFrequency() >= config.NAME_SINGLE_THRESHOLD ) {
isb.append(d1);
return isb.toString();
}
}
return null;
case 3:
/*
* single name: - ignore
* mean the char and the two chars after it make up a word.
*
* it is a double name.
* like: 陈美丽的人生, chunk: 陈_美丽的_人生
*/
String c1 = new String(w1.getValue().charAt(0)+"");
String c2 = new String(w1.getValue().charAt(1)+"");
IWord w3 = dic.get(ILexicon.CJK_WORD, w1.getValue().charAt(2)+"");
if ( dic.match(ILexicon.CN_DNAME_1, c1)
&& dic.match(ILexicon.CN_DNAME_2, c2)
&& (w3 == null || w3.getFrequency() >= config.NAME_SINGLE_THRESHOLD)) {
isb.append(c1);
isb.append(c2);
return isb.toString();
}
return null;
}
}
return null;
} | /**
* find an Chinese name from the current position of the input chars
*
* @param chars
* @param index
* @param chunk
* @return IWord
*/ | find an Chinese name from the current position of the input chars
| [
"find",
"an",
"Chinese",
"name",
"from",
"the",
"current",
"position",
"of",
"the",
"input",
"chars"
] | protected String findCHName( char[] chars, int index, IChunk chunk )
{
StringBuilder isb = new StringBuilder();
/*there is only two IWords in the chunk. */
if ( chunk.getWords().length == 2 ) {
IWord w = chunk.getWords()[1];
switch ( w.getLength() ) {
case 1:
if ( dic.match(ILexicon.CN_SNAME, w.getValue()) ) {
isb.append(w.getValue());
return isb.toString();
}
return null;
case 2:
case 3:
/*
* there is only two IWords in the chunk.
* case 2:
* like: 这本书是陈高的, chunk: 陈_高的
* more: 瓜子和坚果,chunk: 和_坚果 (1.6.8前版本有歧义)
* case 3:
* 1.double name: the two chars and char after it make up a word.
* like: 这本书是陈美丽的, chunk: 陈_美丽的
* 2.single name: the char and the two chars after it make up a word. -ignore
*/
String d1 = new String(w.getValue().charAt(0)+"");
String d2 = new String(w.getValue().charAt(1)+"");
if ( dic.match(ILexicon.CN_DNAME_1, d1)
&& dic.match(ILexicon.CN_DNAME_2, d2)) {
isb.append(d1);
isb.append(d2);
return isb.toString();
}
/*
* the name char of the single name and the char after it
* make up a word.
*/
else if ( dic.match(ILexicon.CN_SNAME, d1) ) {
IWord iw = dic.get(ILexicon.CJK_WORD, d2);
if ( iw != null && iw.getFrequency() >= config.NAME_SINGLE_THRESHOLD ) {
isb.append(d1);
return isb.toString();
}
}
return null;
}
} else {
/*three IWords in the chunk */
IWord w1 = chunk.getWords()[1];
IWord w2 = chunk.getWords()[2];
switch ( w1.getLength() ) {
case 1:
/*check if it is a double name first.*/
if ( dic.match(ILexicon.CN_DNAME_1, w1.getValue()) ) {
if ( w2.getLength() == 1 ) {
/*real double name?*/
if ( dic.match(ILexicon.CN_DNAME_2, w2.getValue()) ) {
isb.append(w1.getValue());
isb.append(w2.getValue());
return isb.toString();
}
/*not a real double name, check if it is a single name.*/
else if ( dic.match(ILexicon.CN_SNAME, w1.getValue()) ) {
isb.append(w1.getValue());
return isb.toString();
}
}
/*
* double name:
* char 2 and the char after it make up a word.
* like: 陈志高兴奋极了, chunk:陈_志_高兴 (兴和后面成词)
* like: 陈志高的, chunk:陈_志_高的 ("的"的阕值Config.SINGLE_THRESHOLD)
* like: 陈高兴奋极了, chunk:陈_高_兴奋 (single name)
*/
else {
String d1 = new String(w2.getValue().charAt(0)+"");
int index_ = index + chunk.getWords()[0].getLength() + 2;
IWord[] ws = getNextMatch(config.MAX_LENGTH, chars, index_, null);
/*is it a double name?*/
if ( dic.match(ILexicon.CN_DNAME_2, d1) &&
(ws.length > 1 || ws[0].getFrequency() >= config.NAME_SINGLE_THRESHOLD)) {
isb.append(w1.getValue());
isb.append(d1);
return isb.toString();
}
/*check if it is a single name*/
else if ( dic.match(ILexicon.CN_SNAME, w1.getValue()) ) {
isb.append(w1.getValue());
return isb.toString();
}
}
}
/*check if it is a single name.*/
else if ( dic.match(ILexicon.CN_SNAME, w1.getValue()) ) {
isb.append(w1.getValue());
return isb.toString();
}
return null;
case 2:
String d1 = new String(w1.getValue().charAt(0)+"");
String d2 = new String(w1.getValue().charAt(1)+"");
/*
* it is a double name and char 1, char 2 make up a word.
* like: 陈美丽是对的, chunk: 陈_美丽_是
* more: 都成为高速公路, chunk:都_成为_高速公路 (1.6.8以前的有歧义)
*/
if ( dic.match(ILexicon.CN_DNAME_1, d1)
&& dic.match(ILexicon.CN_DNAME_2, d2)) {
isb.append(w1.getValue());
return isb.toString();
}
/*
* it is a single name, char 1 and the char after it make up a word.
*/
else if ( dic.match(ILexicon.CN_SNAME, d1) ) {
IWord iw = dic.get(ILexicon.CJK_WORD, d2);
if ( iw != null && iw.getFrequency() >= config.NAME_SINGLE_THRESHOLD ) {
isb.append(d1);
return isb.toString();
}
}
return null;
case 3:
/*
* single name: - ignore
* mean the char and the two chars after it make up a word.
*
* it is a double name.
* like: 陈美丽的人生, chunk: 陈_美丽的_人生
*/
String c1 = new String(w1.getValue().charAt(0)+"");
String c2 = new String(w1.getValue().charAt(1)+"");
IWord w3 = dic.get(ILexicon.CJK_WORD, w1.getValue().charAt(2)+"");
if ( dic.match(ILexicon.CN_DNAME_1, c1)
&& dic.match(ILexicon.CN_DNAME_2, c2)
&& (w3 == null || w3.getFrequency() >= config.NAME_SINGLE_THRESHOLD)) {
isb.append(c1);
isb.append(c2);
return isb.toString();
}
return null;
}
}
return null;
} | [
"protected",
"String",
"findCHName",
"(",
"char",
"[",
"]",
"chars",
",",
"int",
"index",
",",
"IChunk",
"chunk",
")",
"{",
"StringBuilder",
"isb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"/*there is only two IWords in the chunk. */",
"if",
"(",
"chunk",
".",
"getWords",
"(",
")",
".",
"length",
"==",
"2",
")",
"{",
"IWord",
"w",
"=",
"chunk",
".",
"getWords",
"(",
")",
"[",
"1",
"]",
";",
"switch",
"(",
"w",
".",
"getLength",
"(",
")",
")",
"{",
"case",
"1",
":",
"if",
"(",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CN_SNAME",
",",
"w",
".",
"getValue",
"(",
")",
")",
")",
"{",
"isb",
".",
"append",
"(",
"w",
".",
"getValue",
"(",
")",
")",
";",
"return",
"isb",
".",
"toString",
"(",
")",
";",
"}",
"return",
"null",
";",
"case",
"2",
":",
"case",
"3",
":",
"/*\n * there is only two IWords in the chunk.\n * case 2:\n * like: 这本书是陈高的, chunk: 陈_高的\n * more: 瓜子和坚果,chunk: 和_坚果 (1.6.8前版本有歧义)\n * case 3:\n * 1.double name: the two chars and char after it make up a word.\n * like: 这本书是陈美丽的, chunk: 陈_美丽的\n * 2.single name: the char and the two chars after it make up a word. -ignore\n */",
"String",
"d1",
"=",
"new",
"String",
"(",
"w",
".",
"getValue",
"(",
")",
".",
"charAt",
"(",
"0",
")",
"+",
"\"\"",
")",
";",
"String",
"d2",
"=",
"new",
"String",
"(",
"w",
".",
"getValue",
"(",
")",
".",
"charAt",
"(",
"1",
")",
"+",
"\"\"",
")",
";",
"if",
"(",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CN_DNAME_1",
",",
"d1",
")",
"&&",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CN_DNAME_2",
",",
"d2",
")",
")",
"{",
"isb",
".",
"append",
"(",
"d1",
")",
";",
"isb",
".",
"append",
"(",
"d2",
")",
";",
"return",
"isb",
".",
"toString",
"(",
")",
";",
"}",
"/*\n * the name char of the single name and the char after it\n * make up a word. \n */",
"else",
"if",
"(",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CN_SNAME",
",",
"d1",
")",
")",
"{",
"IWord",
"iw",
"=",
"dic",
".",
"get",
"(",
"ILexicon",
".",
"CJK_WORD",
",",
"d2",
")",
";",
"if",
"(",
"iw",
"!=",
"null",
"&&",
"iw",
".",
"getFrequency",
"(",
")",
">=",
"config",
".",
"NAME_SINGLE_THRESHOLD",
")",
"{",
"isb",
".",
"append",
"(",
"d1",
")",
";",
"return",
"isb",
".",
"toString",
"(",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"}",
"else",
"{",
"/*three IWords in the chunk */",
"IWord",
"w1",
"=",
"chunk",
".",
"getWords",
"(",
")",
"[",
"1",
"]",
";",
"IWord",
"w2",
"=",
"chunk",
".",
"getWords",
"(",
")",
"[",
"2",
"]",
";",
"switch",
"(",
"w1",
".",
"getLength",
"(",
")",
")",
"{",
"case",
"1",
":",
"/*check if it is a double name first.*/",
"if",
"(",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CN_DNAME_1",
",",
"w1",
".",
"getValue",
"(",
")",
")",
")",
"{",
"if",
"(",
"w2",
".",
"getLength",
"(",
")",
"==",
"1",
")",
"{",
"/*real double name?*/",
"if",
"(",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CN_DNAME_2",
",",
"w2",
".",
"getValue",
"(",
")",
")",
")",
"{",
"isb",
".",
"append",
"(",
"w1",
".",
"getValue",
"(",
")",
")",
";",
"isb",
".",
"append",
"(",
"w2",
".",
"getValue",
"(",
")",
")",
";",
"return",
"isb",
".",
"toString",
"(",
")",
";",
"}",
"/*not a real double name, check if it is a single name.*/",
"else",
"if",
"(",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CN_SNAME",
",",
"w1",
".",
"getValue",
"(",
")",
")",
")",
"{",
"isb",
".",
"append",
"(",
"w1",
".",
"getValue",
"(",
")",
")",
";",
"return",
"isb",
".",
"toString",
"(",
")",
";",
"}",
"}",
"/*\n * double name:\n * char 2 and the char after it make up a word.\n * like: 陈志高兴奋极了, chunk:陈_志_高兴 (兴和后面成词)\n * like: 陈志高的, chunk:陈_志_高的 (\"的\"的阕值Config.SINGLE_THRESHOLD)\n * like: 陈高兴奋极了, chunk:陈_高_兴奋 (single name)\n */",
"else",
"{",
"String",
"d1",
"=",
"new",
"String",
"(",
"w2",
".",
"getValue",
"(",
")",
".",
"charAt",
"(",
"0",
")",
"+",
"\"\"",
")",
";",
"int",
"index_",
"=",
"index",
"+",
"chunk",
".",
"getWords",
"(",
")",
"[",
"0",
"]",
".",
"getLength",
"(",
")",
"+",
"2",
";",
"IWord",
"[",
"]",
"ws",
"=",
"getNextMatch",
"(",
"config",
".",
"MAX_LENGTH",
",",
"chars",
",",
"index_",
",",
"null",
")",
";",
"/*is it a double name?*/",
"if",
"(",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CN_DNAME_2",
",",
"d1",
")",
"&&",
"(",
"ws",
".",
"length",
">",
"1",
"||",
"ws",
"[",
"0",
"]",
".",
"getFrequency",
"(",
")",
">=",
"config",
".",
"NAME_SINGLE_THRESHOLD",
")",
")",
"{",
"isb",
".",
"append",
"(",
"w1",
".",
"getValue",
"(",
")",
")",
";",
"isb",
".",
"append",
"(",
"d1",
")",
";",
"return",
"isb",
".",
"toString",
"(",
")",
";",
"}",
"/*check if it is a single name*/",
"else",
"if",
"(",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CN_SNAME",
",",
"w1",
".",
"getValue",
"(",
")",
")",
")",
"{",
"isb",
".",
"append",
"(",
"w1",
".",
"getValue",
"(",
")",
")",
";",
"return",
"isb",
".",
"toString",
"(",
")",
";",
"}",
"}",
"}",
"/*check if it is a single name.*/",
"else",
"if",
"(",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CN_SNAME",
",",
"w1",
".",
"getValue",
"(",
")",
")",
")",
"{",
"isb",
".",
"append",
"(",
"w1",
".",
"getValue",
"(",
")",
")",
";",
"return",
"isb",
".",
"toString",
"(",
")",
";",
"}",
"return",
"null",
";",
"case",
"2",
":",
"String",
"d1",
"=",
"new",
"String",
"(",
"w1",
".",
"getValue",
"(",
")",
".",
"charAt",
"(",
"0",
")",
"+",
"\"\"",
")",
";",
"String",
"d2",
"=",
"new",
"String",
"(",
"w1",
".",
"getValue",
"(",
")",
".",
"charAt",
"(",
"1",
")",
"+",
"\"\"",
")",
";",
"/*\n * it is a double name and char 1, char 2 make up a word.\n * like: 陈美丽是对的, chunk: 陈_美丽_是\n * more: 都成为高速公路, chunk:都_成为_高速公路 (1.6.8以前的有歧义)\n */",
"if",
"(",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CN_DNAME_1",
",",
"d1",
")",
"&&",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CN_DNAME_2",
",",
"d2",
")",
")",
"{",
"isb",
".",
"append",
"(",
"w1",
".",
"getValue",
"(",
")",
")",
";",
"return",
"isb",
".",
"toString",
"(",
")",
";",
"}",
"/*\n * it is a single name, char 1 and the char after it make up a word.\n */",
"else",
"if",
"(",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CN_SNAME",
",",
"d1",
")",
")",
"{",
"IWord",
"iw",
"=",
"dic",
".",
"get",
"(",
"ILexicon",
".",
"CJK_WORD",
",",
"d2",
")",
";",
"if",
"(",
"iw",
"!=",
"null",
"&&",
"iw",
".",
"getFrequency",
"(",
")",
">=",
"config",
".",
"NAME_SINGLE_THRESHOLD",
")",
"{",
"isb",
".",
"append",
"(",
"d1",
")",
";",
"return",
"isb",
".",
"toString",
"(",
")",
";",
"}",
"}",
"return",
"null",
";",
"case",
"3",
":",
"/*\n * single name: - ignore\n * mean the char and the two chars after it make up a word.\n * \n * it is a double name.\n * like: 陈美丽的人生, chunk: 陈_美丽的_人生\n */",
"String",
"c1",
"=",
"new",
"String",
"(",
"w1",
".",
"getValue",
"(",
")",
".",
"charAt",
"(",
"0",
")",
"+",
"\"\"",
")",
";",
"String",
"c2",
"=",
"new",
"String",
"(",
"w1",
".",
"getValue",
"(",
")",
".",
"charAt",
"(",
"1",
")",
"+",
"\"\"",
")",
";",
"IWord",
"w3",
"=",
"dic",
".",
"get",
"(",
"ILexicon",
".",
"CJK_WORD",
",",
"w1",
".",
"getValue",
"(",
")",
".",
"charAt",
"(",
"2",
")",
"+",
"\"\"",
")",
";",
"if",
"(",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CN_DNAME_1",
",",
"c1",
")",
"&&",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CN_DNAME_2",
",",
"c2",
")",
"&&",
"(",
"w3",
"==",
"null",
"||",
"w3",
".",
"getFrequency",
"(",
")",
">=",
"config",
".",
"NAME_SINGLE_THRESHOLD",
")",
")",
"{",
"isb",
".",
"append",
"(",
"c1",
")",
";",
"isb",
".",
"append",
"(",
"c2",
")",
";",
"return",
"isb",
".",
"toString",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | find an Chinese name from the current position of the input chars | [
"find",
"an",
"Chinese",
"name",
"from",
"the",
"current",
"position",
"of",
"the",
"input",
"chars"
] | [
"//isb.clear();",
"//System.out.println(\"index:\"+index+\":\"+chars[index]+\", \"+ws[0]);"
] | [
{
"param": "chars",
"type": "char[]"
},
{
"param": "index",
"type": "int"
},
{
"param": "chunk",
"type": "IChunk"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "chars",
"type": "char[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "index",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "chunk",
"type": "IChunk",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
514,
1104,
1792,
461,
12,
1149,
8526,
5230,
16,
509,
770,
16,
467,
5579,
2441,
262,
7010,
565,
288,
203,
3639,
3225,
353,
70,
273,
394,
3225,
5621,
203,
3639,
368,
291,
70,
18,
8507,
5621,
203,
3639,
1748,
18664,
353,
1338,
2795,
467,
7363,
316,
326,
2441,
18,
1195,
203,
3639,
309,
261,
2441,
18,
588,
7363,
7675,
2469,
422,
576,
262,
288,
203,
5411,
467,
3944,
341,
273,
2441,
18,
588,
7363,
1435,
63,
21,
15533,
203,
5411,
1620,
261,
341,
18,
588,
1782,
1435,
262,
288,
203,
5411,
648,
404,
30,
203,
7734,
309,
261,
11681,
18,
1916,
12,
2627,
338,
3950,
18,
12821,
67,
55,
1985,
16,
341,
18,
24805,
10756,
262,
288,
203,
10792,
353,
70,
18,
6923,
12,
91,
18,
24805,
10663,
203,
10792,
327,
353,
70,
18,
10492,
5621,
203,
7734,
289,
203,
7734,
327,
446,
31,
203,
5411,
648,
576,
30,
203,
5411,
648,
890,
30,
203,
7734,
1748,
203,
1171,
380,
1915,
353,
1338,
2795,
467,
7363,
316,
326,
2441,
18,
203,
1171,
380,
648,
576,
30,
203,
1171,
380,
3007,
30,
225,
169,
128,
252,
167,
255,
110,
165,
122,
104,
167,
251,
112,
170,
252,
235,
170,
109,
251,
168,
253,
231,
16,
2441,
30,
225,
170,
252,
235,
67,
170,
109,
251,
168,
253,
231,
203,
1171,
380,
1898,
30,
225,
168,
246,
255,
166,
260,
243,
166,
245,
239,
166,
256,
253,
167,
257,
255,
16,
6551,
30,
225,
166,
245,
239,
67,
166,
256,
253,
167,
257,
255,
261,
21,
18,
26,
18,
28,
166,
236,
240,
168,
236,
235,
167,
255,
110,
167,
255,
236,
167,
260,
105,
165,
122,
236,
13,
203,
1171,
380,
648,
890,
30,
203,
1171,
380,
404,
18,
9056,
508,
30,
326,
2795,
5230,
471,
1149,
1839,
518,
1221,
731,
279,
2076,
18,
203,
1171,
380,
3007,
30,
225,
169,
128,
252,
167,
255,
110,
165,
122,
104,
167,
251,
112,
170,
252,
235,
168,
127,
241,
165,
121,
126,
168,
253,
231,
16,
2441,
30,
225,
170,
252,
235,
67,
168,
127,
241,
165,
121,
126,
168,
253,
231,
203,
1171,
380,
576,
18,
7526,
508,
30,
326,
1149,
471,
326,
2795,
5230,
1839,
518,
1221,
731,
279,
2076,
18,
300,
6185,
203,
1171,
1195,
203,
7734,
514,
302,
21,
273,
394,
514,
12,
91,
18,
24805,
7675,
3001,
861,
12,
20,
27921,
3660,
1769,
203,
7734,
514,
302,
22,
273,
394,
514,
12,
91,
18,
24805,
7675,
3001,
861,
12,
21,
27921,
3660,
1769,
203,
7734,
309,
261,
11681,
18,
1916,
12,
2627,
338,
3950,
18,
12821,
67,
40,
1985,
67,
21,
16,
302,
21,
13,
203,
13491,
597,
11681,
18,
1916,
12,
2627,
338,
3950,
18,
12821,
67,
40,
1985,
67,
22,
16,
302,
22,
3719,
288,
203,
10792,
353,
70,
18,
6923,
12,
72,
21,
1769,
203,
10792,
353,
70,
18,
6923,
12,
72,
22,
1769,
203,
10792,
327,
353,
70,
18,
10492,
5621,
203,
7734,
289,
7010,
7734,
1748,
203,
1171,
380,
326,
508,
1149,
434,
326,
2202,
508,
471,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
1104,
392,
1680,
25331,
508,
628,
326,
783,
1754,
434,
326,
810,
5230,
203,
377,
380,
7010,
377,
380,
632,
891,
5230,
203,
377,
380,
632,
891,
770,
203,
377,
380,
632,
891,
2441,
203,
377,
380,
632,
2463,
467,
3944,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
977fb6a25f7c4dfcd2e195bdb6baef87e1fef830 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/segmenter/Segmenter.java | [
"Apache-2.0"
] | Java | nextLetterNumber | String | protected String nextLetterNumber( int c ) throws IOException
{
//StringBuilder isb = new StringBuilder();
isb.clear();
isb.append((char)c);
int ch;
while ( (ch = readNext()) != -1 ) {
if ( StringUtil.isWhitespace(ch) ) {
pushBack(ch);
break;
}
if ( ! StringUtil.isLetterNumber( ch ) ) {
pushBack(ch);
break;
}
isb.append((char)ch);
}
return isb.toString();
} | /**
* find the next other letter from the current position
* find the letter number from the current position
* count until the char in the specified position is not a letter number or whitespace
*
* @param c
* @return String
* @throws IOException
*/ | find the next other letter from the current position
find the letter number from the current position
count until the char in the specified position is not a letter number or whitespace
@param c
@return String
@throws IOException | [
"find",
"the",
"next",
"other",
"letter",
"from",
"the",
"current",
"position",
"find",
"the",
"letter",
"number",
"from",
"the",
"current",
"position",
"count",
"until",
"the",
"char",
"in",
"the",
"specified",
"position",
"is",
"not",
"a",
"letter",
"number",
"or",
"whitespace",
"@param",
"c",
"@return",
"String",
"@throws",
"IOException"
] | protected String nextLetterNumber( int c ) throws IOException
{
isb.clear();
isb.append((char)c);
int ch;
while ( (ch = readNext()) != -1 ) {
if ( StringUtil.isWhitespace(ch) ) {
pushBack(ch);
break;
}
if ( ! StringUtil.isLetterNumber( ch ) ) {
pushBack(ch);
break;
}
isb.append((char)ch);
}
return isb.toString();
} | [
"protected",
"String",
"nextLetterNumber",
"(",
"int",
"c",
")",
"throws",
"IOException",
"{",
"isb",
".",
"clear",
"(",
")",
";",
"isb",
".",
"append",
"(",
"(",
"char",
")",
"c",
")",
";",
"int",
"ch",
";",
"while",
"(",
"(",
"ch",
"=",
"readNext",
"(",
")",
")",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"StringUtil",
".",
"isWhitespace",
"(",
"ch",
")",
")",
"{",
"pushBack",
"(",
"ch",
")",
";",
"break",
";",
"}",
"if",
"(",
"!",
"StringUtil",
".",
"isLetterNumber",
"(",
"ch",
")",
")",
"{",
"pushBack",
"(",
"ch",
")",
";",
"break",
";",
"}",
"isb",
".",
"append",
"(",
"(",
"char",
")",
"ch",
")",
";",
"}",
"return",
"isb",
".",
"toString",
"(",
")",
";",
"}"
] | find the next other letter from the current position
find the letter number from the current position
count until the char in the specified position is not a letter number or whitespace | [
"find",
"the",
"next",
"other",
"letter",
"from",
"the",
"current",
"position",
"find",
"the",
"letter",
"number",
"from",
"the",
"current",
"position",
"count",
"until",
"the",
"char",
"in",
"the",
"specified",
"position",
"is",
"not",
"a",
"letter",
"number",
"or",
"whitespace"
] | [
"//StringBuilder isb = new StringBuilder();"
] | [
{
"param": "c",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
514,
1024,
13938,
1854,
12,
509,
276,
262,
1216,
1860,
7010,
565,
288,
203,
3639,
368,
21253,
353,
70,
273,
394,
3225,
5621,
203,
3639,
353,
70,
18,
8507,
5621,
203,
3639,
353,
70,
18,
6923,
12443,
3001,
13,
71,
1769,
203,
3639,
509,
462,
31,
203,
3639,
1323,
261,
261,
343,
273,
855,
2134,
10756,
480,
300,
21,
262,
288,
203,
5411,
309,
261,
14205,
18,
291,
9431,
12,
343,
13,
262,
288,
203,
7734,
1817,
2711,
12,
343,
1769,
203,
7734,
898,
31,
203,
5411,
289,
203,
2398,
203,
5411,
309,
261,
401,
14205,
18,
291,
13938,
1854,
12,
462,
262,
262,
288,
203,
7734,
1817,
2711,
12,
343,
1769,
203,
7734,
898,
31,
203,
5411,
289,
203,
2398,
203,
5411,
353,
70,
18,
6923,
12443,
3001,
13,
343,
1769,
203,
3639,
289,
203,
540,
203,
3639,
327,
353,
70,
18,
10492,
5621,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1104,
326,
1024,
1308,
9471,
628,
326,
783,
1754,
203,
377,
380,
1104,
326,
9471,
1300,
628,
326,
783,
1754,
203,
377,
380,
1056,
3180,
326,
1149,
316,
326,
1269,
1754,
353,
486,
279,
9471,
1300,
578,
7983,
203,
377,
380,
7010,
377,
380,
632,
891,
276,
203,
377,
380,
632,
2463,
514,
203,
377,
380,
632,
15069,
1860,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
bf453ca93aa587ee4f7dfa87f79faa64295192b8 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/IHashQueue.java | [
"Apache-2.0"
] | Java | remove | T | public T remove()
{
if ( size == 0 ) {
return null;
}
//remove the first element
Entry<T> o = head.next;
head.next = o.next;
o.next.prev = head;
//bakup the data
T v = o.data;
size--;
index.remove(v.getValue());
o = null; //Let gc do its work
return v;
} | /**
* remove the node from the head
* and you should make sure the size is larger than 0 by calling size()
* before you invoke the method or you will just get null.
*/ | remove the node from the head
and you should make sure the size is larger than 0 by calling size()
before you invoke the method or you will just get null. | [
"remove",
"the",
"node",
"from",
"the",
"head",
"and",
"you",
"should",
"make",
"sure",
"the",
"size",
"is",
"larger",
"than",
"0",
"by",
"calling",
"size",
"()",
"before",
"you",
"invoke",
"the",
"method",
"or",
"you",
"will",
"just",
"get",
"null",
"."
] | public T remove()
{
if ( size == 0 ) {
return null;
}
Entry<T> o = head.next;
head.next = o.next;
o.next.prev = head;
T v = o.data;
size--;
index.remove(v.getValue());
o = null;
return v;
} | [
"public",
"T",
"remove",
"(",
")",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"Entry",
"<",
"T",
">",
"o",
"=",
"head",
".",
"next",
";",
"head",
".",
"next",
"=",
"o",
".",
"next",
";",
"o",
".",
"next",
".",
"prev",
"=",
"head",
";",
"T",
"v",
"=",
"o",
".",
"data",
";",
"size",
"--",
";",
"index",
".",
"remove",
"(",
"v",
".",
"getValue",
"(",
")",
")",
";",
"o",
"=",
"null",
";",
"return",
"v",
";",
"}"
] | remove the node from the head
and you should make sure the size is larger than 0 by calling size()
before you invoke the method or you will just get null. | [
"remove",
"the",
"node",
"from",
"the",
"head",
"and",
"you",
"should",
"make",
"sure",
"the",
"size",
"is",
"larger",
"than",
"0",
"by",
"calling",
"size",
"()",
"before",
"you",
"invoke",
"the",
"method",
"or",
"you",
"will",
"just",
"get",
"null",
"."
] | [
"//remove the first element",
"//bakup the data",
"//Let gc do its work"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
399,
1206,
1435,
203,
565,
288,
203,
3639,
309,
261,
963,
422,
374,
262,
288,
203,
5411,
327,
446,
31,
203,
3639,
289,
203,
540,
203,
3639,
368,
4479,
326,
1122,
930,
203,
3639,
3841,
32,
56,
34,
320,
273,
910,
18,
4285,
31,
203,
3639,
910,
18,
4285,
282,
273,
320,
18,
4285,
31,
203,
3639,
320,
18,
4285,
18,
10001,
273,
910,
31,
203,
540,
203,
3639,
368,
31170,
416,
326,
501,
203,
3639,
399,
331,
540,
273,
320,
18,
892,
31,
203,
3639,
963,
413,
31,
203,
3639,
770,
18,
4479,
12,
90,
18,
24805,
10663,
203,
540,
203,
3639,
320,
273,
446,
31,
5411,
368,
24181,
8859,
741,
2097,
1440,
203,
540,
203,
3639,
327,
331,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1206,
326,
756,
628,
326,
910,
203,
377,
380,
471,
1846,
1410,
1221,
3071,
326,
963,
353,
10974,
2353,
374,
635,
4440,
963,
1435,
203,
377,
380,
1865,
1846,
4356,
326,
707,
578,
1846,
903,
2537,
336,
446,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
8332e84ffce2f939acd47b8295a1a626dffb225c | passerbya/jcseg | jcseg-core/src/test/java/org/lionsoul/jcseg/test/DicMerge.java | [
"Apache-2.0"
] | Java | merge | null | public static int merge( File[] srcFiles, File dstFile ) throws IOException
{
//merge the source dictionary.
IWord word = null;
BufferedReader reader = null;
String keywords = null;
HashMap<String, IWord> entries = new HashMap<String, IWord>();
for ( int j = 0; j < srcFiles.length; j++ )
{
String line = null;
reader = new BufferedReader(new FileReader(srcFiles[j]));
keywords = reader.readLine();
while ( (line = reader.readLine()) != null ) {
line = line.trim();
//clear the comment and the whitespace
if ( line.equals("") ) continue;
if ( line.length() > 1 && line.charAt(0) == '#' ) continue;
if ( line.indexOf('/') == -1 ) { //simple word
if ( ! entries.containsKey(line) )
entries.put(line, new Word(line, 1));
continue;
}
// 人事部/nt/ren shi bu/人事管理部門,人事管理部
String[] splits = line.split("/");
if ( splits.length < 4 ) {
line = null;
splits = null; //let the gc do its work.
continue;
}
//get the entries
word = entries.get(splits[0]);
if ( word == null )
{
int type = 0, fre = 0;
if ( splits.length > 4 ) {
fre = Integer.parseInt(splits[4]);
type = 2;
}
word = new Word(splits[0], fre, type);
if ( ! splits[1].equals("null") ) //part of the speech
word.setPartSpeech(splits[1].split(","));
if ( ! ( splits[2].equals("%")
|| splits[2].equals("null")) ) //pinyin
word.setPinyin(splits[2]);
/*if ( ! splits[3].equals("null") ) //synonyms
word.setSyn(splits[3].split(","));*/
entries.put(splits[0], word);
}
else {
//System.out.println("re-word: " + splits[0]);
//check check the part of the speech
if ( ! splits[1].equals("null") ) {
String[] pps = splits[1].split(",");
if ( word.getPartSpeech() == null)
word.setPartSpeech(pps);
else {
/*String[] ps = word.getPartSpeech();
for ( int i = 0; i < pps.length; i++ )
if ( ! inArray(ps, pps[i]) ) word.addSyn(pps[i]);*/
}
pps = null;
}
//check the pinyin
if ( word.getPinyin() == null
&& ! splits[2].equals("null") )
word.setPinyin(splits[2]);
//check the synonyms.
/*if ( ! splits[3].equals("null") ) {
String[] syns = splits[3].split(",");
if ( word.getSyn() == null )
word.setSyn(syns);
else {
String[] syn = word.getSyn();
for ( int i = 0; i < syns.length; i++ )
if ( ! inArray(syn, syns[i]) ) word.addSyn(syns[i]);
}
syns = null;
}*/
}
} //end of while
reader.close();
}
//sort the entries by natrual order.
String[] keys = new String[entries.size()];
entries.keySet().toArray(keys);
Sort.quicksort(keys);
//write the merged entries to the destination file.
BufferedWriter writer = new BufferedWriter(new FileWriter(dstFile));
writer.write(keywords);
writer.write('\n');
IStringBuffer isb = new IStringBuffer();
for ( int j = 0; j < keys.length; j++ ) {
word = entries.get(keys[j]);
/* Here:
* if the orgin lexicon is simple lexicon.
* we just need the word item.
*
* @added 2013-11-28
*/
if ( word.getType() == 1 ) {
writer.write(word.getValue());
writer.write('\n');
continue;
}
isb.clear();
isb.append(word.getValue()); //word
isb.append('/');
if ( word.getPartSpeech() == null ) //part of speech
isb.append("null");
else {
String[] ps = word.getPartSpeech();
for ( int i = 0; i < ps.length; i++ ) {
if ( i == 0 )
isb.append(ps[0]);
else {
isb.append(',');
isb.append(ps[i]);
}
}
}
isb.append('/');
if ( word.getPinyin() == null ) //pinyin
isb.append("null");
else
isb.append(word.getPinyin());
isb.append('/');
/*if ( word.getSyn() == null ) //synonyms
isb.append("null");
else {
String[] syn = word.getSyn();
for ( int i = 0; i < syn.length; i++ ) {
if ( i == 0 )
isb.append(syn[0]);
else {
isb.append(',');
isb.append(syn[i]);
}
}
}*/
if ( word.getType() == 2 ) { //single word degree
isb.append('/');
isb.append(""+word.getFrequency());
}
writer.write(isb.buffer(), 0, isb.length());
writer.write('\n');
}
writer.close();
return keys.length;
} | /**
* merge two jcseg dictionary files
* remove the duplicate entries and store the entris in a specified file
*
* @param srcFiles
* @param dstFile
* @return int
* @throws IOException
*/ | merge two jcseg dictionary files
remove the duplicate entries and store the entris in a specified file
@param srcFiles
@param dstFile
@return int
@throws IOException | [
"merge",
"two",
"jcseg",
"dictionary",
"files",
"remove",
"the",
"duplicate",
"entries",
"and",
"store",
"the",
"entris",
"in",
"a",
"specified",
"file",
"@param",
"srcFiles",
"@param",
"dstFile",
"@return",
"int",
"@throws",
"IOException"
] | public static int merge( File[] srcFiles, File dstFile ) throws IOException
{
IWord word = null;
BufferedReader reader = null;
String keywords = null;
HashMap<String, IWord> entries = new HashMap<String, IWord>();
for ( int j = 0; j < srcFiles.length; j++ )
{
String line = null;
reader = new BufferedReader(new FileReader(srcFiles[j]));
keywords = reader.readLine();
while ( (line = reader.readLine()) != null ) {
line = line.trim();
if ( line.equals("") ) continue;
if ( line.length() > 1 && line.charAt(0) == '#' ) continue;
if ( line.indexOf('/') == -1 ) {
if ( ! entries.containsKey(line) )
entries.put(line, new Word(line, 1));
continue;
}
String[] splits = line.split("/");
if ( splits.length < 4 ) {
line = null;
splits = null;
continue;
}
word = entries.get(splits[0]);
if ( word == null )
{
int type = 0, fre = 0;
if ( splits.length > 4 ) {
fre = Integer.parseInt(splits[4]);
type = 2;
}
word = new Word(splits[0], fre, type);
if ( ! splits[1].equals("null") )
word.setPartSpeech(splits[1].split(","));
if ( ! ( splits[2].equals("%")
|| splits[2].equals("null")) )
word.setPinyin(splits[2]);
/*if ( ! splits[3].equals("null") ) //synonyms
word.setSyn(splits[3].split(","));*/
entries.put(splits[0], word);
}
else {
if ( ! splits[1].equals("null") ) {
String[] pps = splits[1].split(",");
if ( word.getPartSpeech() == null)
word.setPartSpeech(pps);
else {
/*String[] ps = word.getPartSpeech();
for ( int i = 0; i < pps.length; i++ )
if ( ! inArray(ps, pps[i]) ) word.addSyn(pps[i]);*/
}
pps = null;
}
if ( word.getPinyin() == null
&& ! splits[2].equals("null") )
word.setPinyin(splits[2]);
/*if ( ! splits[3].equals("null") ) {
String[] syns = splits[3].split(",");
if ( word.getSyn() == null )
word.setSyn(syns);
else {
String[] syn = word.getSyn();
for ( int i = 0; i < syns.length; i++ )
if ( ! inArray(syn, syns[i]) ) word.addSyn(syns[i]);
}
syns = null;
}*/
}
}
reader.close();
}
String[] keys = new String[entries.size()];
entries.keySet().toArray(keys);
Sort.quicksort(keys);
BufferedWriter writer = new BufferedWriter(new FileWriter(dstFile));
writer.write(keywords);
writer.write('\n');
IStringBuffer isb = new IStringBuffer();
for ( int j = 0; j < keys.length; j++ ) {
word = entries.get(keys[j]);
/* Here:
* if the orgin lexicon is simple lexicon.
* we just need the word item.
*
* @added 2013-11-28
*/
if ( word.getType() == 1 ) {
writer.write(word.getValue());
writer.write('\n');
continue;
}
isb.clear();
isb.append(word.getValue());
isb.append('/');
if ( word.getPartSpeech() == null )
isb.append("null");
else {
String[] ps = word.getPartSpeech();
for ( int i = 0; i < ps.length; i++ ) {
if ( i == 0 )
isb.append(ps[0]);
else {
isb.append(',');
isb.append(ps[i]);
}
}
}
isb.append('/');
if ( word.getPinyin() == null )
isb.append("null");
else
isb.append(word.getPinyin());
isb.append('/');
/*if ( word.getSyn() == null ) //synonyms
isb.append("null");
else {
String[] syn = word.getSyn();
for ( int i = 0; i < syn.length; i++ ) {
if ( i == 0 )
isb.append(syn[0]);
else {
isb.append(',');
isb.append(syn[i]);
}
}
}*/
if ( word.getType() == 2 ) {
isb.append('/');
isb.append(""+word.getFrequency());
}
writer.write(isb.buffer(), 0, isb.length());
writer.write('\n');
}
writer.close();
return keys.length;
} | [
"public",
"static",
"int",
"merge",
"(",
"File",
"[",
"]",
"srcFiles",
",",
"File",
"dstFile",
")",
"throws",
"IOException",
"{",
"IWord",
"word",
"=",
"null",
";",
"BufferedReader",
"reader",
"=",
"null",
";",
"String",
"keywords",
"=",
"null",
";",
"HashMap",
"<",
"String",
",",
"IWord",
">",
"entries",
"=",
"new",
"HashMap",
"<",
"String",
",",
"IWord",
">",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"srcFiles",
".",
"length",
";",
"j",
"++",
")",
"{",
"String",
"line",
"=",
"null",
";",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"srcFiles",
"[",
"j",
"]",
")",
")",
";",
"keywords",
"=",
"reader",
".",
"readLine",
"(",
")",
";",
"while",
"(",
"(",
"line",
"=",
"reader",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"line",
"=",
"line",
".",
"trim",
"(",
")",
";",
"if",
"(",
"line",
".",
"equals",
"(",
"\"\"",
")",
")",
"continue",
";",
"if",
"(",
"line",
".",
"length",
"(",
")",
">",
"1",
"&&",
"line",
".",
"charAt",
"(",
"0",
")",
"==",
"'#'",
")",
"continue",
";",
"if",
"(",
"line",
".",
"indexOf",
"(",
"'/'",
")",
"==",
"-",
"1",
")",
"{",
"if",
"(",
"!",
"entries",
".",
"containsKey",
"(",
"line",
")",
")",
"entries",
".",
"put",
"(",
"line",
",",
"new",
"Word",
"(",
"line",
",",
"1",
")",
")",
";",
"continue",
";",
"}",
"String",
"[",
"]",
"splits",
"=",
"line",
".",
"split",
"(",
"\"/\"",
")",
";",
"if",
"(",
"splits",
".",
"length",
"<",
"4",
")",
"{",
"line",
"=",
"null",
";",
"splits",
"=",
"null",
";",
"continue",
";",
"}",
"word",
"=",
"entries",
".",
"get",
"(",
"splits",
"[",
"0",
"]",
")",
";",
"if",
"(",
"word",
"==",
"null",
")",
"{",
"int",
"type",
"=",
"0",
",",
"fre",
"=",
"0",
";",
"if",
"(",
"splits",
".",
"length",
">",
"4",
")",
"{",
"fre",
"=",
"Integer",
".",
"parseInt",
"(",
"splits",
"[",
"4",
"]",
")",
";",
"type",
"=",
"2",
";",
"}",
"word",
"=",
"new",
"Word",
"(",
"splits",
"[",
"0",
"]",
",",
"fre",
",",
"type",
")",
";",
"if",
"(",
"!",
"splits",
"[",
"1",
"]",
".",
"equals",
"(",
"\"null\"",
")",
")",
"word",
".",
"setPartSpeech",
"(",
"splits",
"[",
"1",
"]",
".",
"split",
"(",
"\",\"",
")",
")",
";",
"if",
"(",
"!",
"(",
"splits",
"[",
"2",
"]",
".",
"equals",
"(",
"\"%\"",
")",
"||",
"splits",
"[",
"2",
"]",
".",
"equals",
"(",
"\"null\"",
")",
")",
")",
"word",
".",
"setPinyin",
"(",
"splits",
"[",
"2",
"]",
")",
";",
"/*if ( ! splits[3].equals(\"null\") ) //synonyms\n word.setSyn(splits[3].split(\",\"));*/",
"entries",
".",
"put",
"(",
"splits",
"[",
"0",
"]",
",",
"word",
")",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"splits",
"[",
"1",
"]",
".",
"equals",
"(",
"\"null\"",
")",
")",
"{",
"String",
"[",
"]",
"pps",
"=",
"splits",
"[",
"1",
"]",
".",
"split",
"(",
"\",\"",
")",
";",
"if",
"(",
"word",
".",
"getPartSpeech",
"(",
")",
"==",
"null",
")",
"word",
".",
"setPartSpeech",
"(",
"pps",
")",
";",
"else",
"{",
"/*String[] ps = word.getPartSpeech();\n for ( int i = 0; i < pps.length; i++ )\n if ( ! inArray(ps, pps[i]) ) word.addSyn(pps[i]);*/",
"}",
"pps",
"=",
"null",
";",
"}",
"if",
"(",
"word",
".",
"getPinyin",
"(",
")",
"==",
"null",
"&&",
"!",
"splits",
"[",
"2",
"]",
".",
"equals",
"(",
"\"null\"",
")",
")",
"word",
".",
"setPinyin",
"(",
"splits",
"[",
"2",
"]",
")",
";",
"/*if ( ! splits[3].equals(\"null\") ) {\n String[] syns = splits[3].split(\",\");\n if ( word.getSyn() == null )\n word.setSyn(syns);\n else {\n String[] syn = word.getSyn();\n for ( int i = 0; i < syns.length; i++ )\n if ( ! inArray(syn, syns[i]) ) word.addSyn(syns[i]);\n }\n syns = null;\n }*/",
"}",
"}",
"reader",
".",
"close",
"(",
")",
";",
"}",
"String",
"[",
"]",
"keys",
"=",
"new",
"String",
"[",
"entries",
".",
"size",
"(",
")",
"]",
";",
"entries",
".",
"keySet",
"(",
")",
".",
"toArray",
"(",
"keys",
")",
";",
"Sort",
".",
"quicksort",
"(",
"keys",
")",
";",
"BufferedWriter",
"writer",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter",
"(",
"dstFile",
")",
")",
";",
"writer",
".",
"write",
"(",
"keywords",
")",
";",
"writer",
".",
"write",
"(",
"'\\n'",
")",
";",
"IStringBuffer",
"isb",
"=",
"new",
"IStringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"keys",
".",
"length",
";",
"j",
"++",
")",
"{",
"word",
"=",
"entries",
".",
"get",
"(",
"keys",
"[",
"j",
"]",
")",
";",
"/* Here:\n * if the orgin lexicon is simple lexicon.\n * we just need the word item.\n * \n * @added 2013-11-28\n */",
"if",
"(",
"word",
".",
"getType",
"(",
")",
"==",
"1",
")",
"{",
"writer",
".",
"write",
"(",
"word",
".",
"getValue",
"(",
")",
")",
";",
"writer",
".",
"write",
"(",
"'\\n'",
")",
";",
"continue",
";",
"}",
"isb",
".",
"clear",
"(",
")",
";",
"isb",
".",
"append",
"(",
"word",
".",
"getValue",
"(",
")",
")",
";",
"isb",
".",
"append",
"(",
"'/'",
")",
";",
"if",
"(",
"word",
".",
"getPartSpeech",
"(",
")",
"==",
"null",
")",
"isb",
".",
"append",
"(",
"\"null\"",
")",
";",
"else",
"{",
"String",
"[",
"]",
"ps",
"=",
"word",
".",
"getPartSpeech",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ps",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"==",
"0",
")",
"isb",
".",
"append",
"(",
"ps",
"[",
"0",
"]",
")",
";",
"else",
"{",
"isb",
".",
"append",
"(",
"','",
")",
";",
"isb",
".",
"append",
"(",
"ps",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"isb",
".",
"append",
"(",
"'/'",
")",
";",
"if",
"(",
"word",
".",
"getPinyin",
"(",
")",
"==",
"null",
")",
"isb",
".",
"append",
"(",
"\"null\"",
")",
";",
"else",
"isb",
".",
"append",
"(",
"word",
".",
"getPinyin",
"(",
")",
")",
";",
"isb",
".",
"append",
"(",
"'/'",
")",
";",
"/*if ( word.getSyn() == null ) //synonyms\n isb.append(\"null\");\n else {\n String[] syn = word.getSyn();\n for ( int i = 0; i < syn.length; i++ ) {\n if ( i == 0 )\n isb.append(syn[0]);\n else {\n isb.append(',');\n isb.append(syn[i]);\n }\n }\n }*/",
"if",
"(",
"word",
".",
"getType",
"(",
")",
"==",
"2",
")",
"{",
"isb",
".",
"append",
"(",
"'/'",
")",
";",
"isb",
".",
"append",
"(",
"\"\"",
"+",
"word",
".",
"getFrequency",
"(",
")",
")",
";",
"}",
"writer",
".",
"write",
"(",
"isb",
".",
"buffer",
"(",
")",
",",
"0",
",",
"isb",
".",
"length",
"(",
")",
")",
";",
"writer",
".",
"write",
"(",
"'\\n'",
")",
";",
"}",
"writer",
".",
"close",
"(",
")",
";",
"return",
"keys",
".",
"length",
";",
"}"
] | merge two jcseg dictionary files
remove the duplicate entries and store the entris in a specified file | [
"merge",
"two",
"jcseg",
"dictionary",
"files",
"remove",
"the",
"duplicate",
"entries",
"and",
"store",
"the",
"entris",
"in",
"a",
"specified",
"file"
] | [
"//merge the source dictionary.",
"//clear the comment and the whitespace",
"//simple word",
"// 人事部/nt/ren shi bu/人事管理部門,人事管理部 ",
"//let the gc do its work.",
"//get the entries",
"//part of the speech",
"//pinyin",
"//System.out.println(\"re-word: \" + splits[0]);",
"//check check the part of the speech",
"//check the pinyin",
"//check the synonyms.",
"//end of while",
"//sort the entries by natrual order.",
"//write the merged entries to the destination file.",
"//word",
"//part of speech",
"//pinyin",
"//single word degree"
] | [
{
"param": "srcFiles",
"type": "File[]"
},
{
"param": "dstFile",
"type": "File"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "srcFiles",
"type": "File[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dstFile",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
509,
2691,
12,
1387,
8526,
1705,
2697,
16,
1387,
3046,
812,
262,
1216,
1860,
7010,
565,
288,
203,
3639,
368,
2702,
326,
1084,
3880,
18,
203,
3639,
467,
3944,
2076,
273,
446,
31,
203,
3639,
10633,
2949,
273,
446,
31,
203,
3639,
514,
7093,
273,
446,
31,
203,
3639,
4317,
32,
780,
16,
467,
3944,
34,
3222,
273,
394,
4317,
32,
780,
16,
467,
3944,
34,
5621,
203,
540,
203,
3639,
364,
261,
509,
525,
273,
374,
31,
525,
411,
1705,
2697,
18,
2469,
31,
525,
9904,
225,
262,
7010,
3639,
288,
203,
5411,
514,
980,
273,
446,
31,
203,
5411,
2949,
273,
394,
10633,
12,
2704,
23010,
12,
4816,
2697,
63,
78,
5717,
1769,
203,
5411,
7093,
273,
2949,
18,
896,
1670,
5621,
203,
5411,
1323,
261,
261,
1369,
273,
2949,
18,
896,
1670,
10756,
480,
446,
262,
288,
203,
7734,
980,
273,
980,
18,
5290,
5621,
203,
7734,
368,
8507,
326,
2879,
471,
326,
7983,
203,
7734,
309,
261,
980,
18,
14963,
2932,
7923,
262,
1324,
31,
203,
7734,
309,
261,
980,
18,
2469,
1435,
405,
404,
597,
980,
18,
3001,
861,
12,
20,
13,
422,
6501,
262,
1324,
31,
203,
7734,
309,
261,
980,
18,
31806,
2668,
2473,
13,
422,
300,
21,
262,
288,
565,
368,
9647,
2076,
203,
10792,
309,
261,
401,
3222,
18,
12298,
653,
12,
1369,
13,
262,
203,
13491,
3222,
18,
458,
12,
1369,
16,
394,
9926,
12,
1369,
16,
404,
10019,
203,
10792,
1324,
31,
203,
7734,
289,
203,
1171,
203,
7734,
368,
225,
165,
123,
123,
165,
123,
238,
170,
230,
106,
19,
496,
19,
1187,
699,
77,
25666,
19,
165,
123,
123,
165,
123,
238,
168,
111,
99,
168,
243,
233,
170,
230,
106,
170,
249,
227,
16,
165,
123,
123,
165,
123,
238,
168,
111,
99,
168,
243,
233,
170,
230,
106,
7010,
7734,
514,
8526,
11019,
273,
980,
18,
4939,
2932,
4898,
1769,
203,
7734,
309,
261,
11019,
18,
2469,
411,
1059,
262,
288,
203,
10792,
980,
273,
446,
31,
203,
10792,
11019,
273,
446,
31,
3639,
368,
1810,
326,
8859,
741,
2097,
1440,
18,
203,
10792,
1324,
31,
203,
7734,
289,
203,
1171,
203,
7734,
368,
588,
326,
3222,
203,
7734,
2076,
273,
3222,
18,
588,
12,
21902,
63,
20,
19226,
203,
7734,
309,
261,
2076,
422,
446,
262,
7010,
7734,
288,
203,
10792,
509,
618,
273,
374,
16,
22010,
273,
374,
31,
203,
10792,
309,
261,
11019,
18,
2469,
405,
1059,
262,
288,
203,
13491,
22010,
273,
2144,
18,
2670,
1702,
12,
21902,
63,
24,
19226,
203,
13491,
618,
273,
576,
31,
203,
10792,
289,
203,
10792,
2076,
273,
394,
9926,
12,
21902,
63,
20,
6487,
22010,
16,
618,
1769,
203,
10792,
309,
261,
401,
11019,
63,
21,
8009,
14963,
2932,
2011,
7923,
262,
3639,
368,
2680,
434,
326,
24556,
203,
13491,
2076,
18,
542,
1988,
22334,
12,
21902,
63,
21,
8009,
4939,
2932,
16,
7923,
1769,
203,
10792,
309,
261,
401,
261,
11019,
63,
22,
8009,
14963,
27188,
7923,
203,
18701,
747,
11019,
63,
22,
8009,
14963,
2932,
2011,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
2691,
2795,
19807,
5680,
3880,
1390,
203,
377,
380,
1206,
326,
6751,
3222,
471,
1707,
326,
31976,
291,
316,
279,
1269,
585,
203,
377,
380,
7010,
377,
380,
632,
891,
565,
1705,
2697,
203,
377,
380,
632,
891,
565,
3046,
812,
203,
377,
380,
632,
2463,
565,
509,
203,
377,
380,
632,
15069,
377,
1860,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
65858bbc232eff10e7bce7a7590af8aaaa2bacd4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/dic/DictionaryFactory.java | [
"Apache-2.0"
] | Java | createDefaultDictionary | ADictionary | public static ADictionary createDefaultDictionary(
SegmenterConfig config, boolean sync, boolean loadDic )
{
final ADictionary dic = (ADictionary) IDictionary.HASHMAP.factory.create(config, sync);
if ( loadDic == false ) {
return dic;
}
try {
/*
* @Note: updated at 2016/07/07
*
* check and load all the lexicons with more than one path
* if specified none lexicon paths (config.getLexiconPath() is null)
* And we directly load the default lexicons that in the class path
*/
String[] lexpath = config.getLexiconPath();
if ( lexpath == null ) {
dic.loadClassPath();
} else {
for ( String lpath : lexpath ) dic.loadDirectory(lpath);
if ( config.isAutoload() ) dic.startAutoload();
}
/*
* added at 2017/06/10
* check and reset synonyms net of the current Dictionary
*/
dic.resetSynonymsNet();
} catch (IOException e) {
e.printStackTrace();
}
return dic;
} | /**
* create a default ADictionary instance:
* 1. check the lexicon path and load the lexicons
* if it is null and default to load the lexicon in the classpath
* 2. check and start the autoload of the dictionary
*
* @param config
* @param sync
* @param loadDic whether check and load the lexicon
* @return IDictionary
*/ | create a default ADictionary instance:
1. check the lexicon path and load the lexicons
if it is null and default to load the lexicon in the classpath
2. check and start the autoload of the dictionary
@param config
@param sync
@param loadDic whether check and load the lexicon
@return IDictionary | [
"create",
"a",
"default",
"ADictionary",
"instance",
":",
"1",
".",
"check",
"the",
"lexicon",
"path",
"and",
"load",
"the",
"lexicons",
"if",
"it",
"is",
"null",
"and",
"default",
"to",
"load",
"the",
"lexicon",
"in",
"the",
"classpath",
"2",
".",
"check",
"and",
"start",
"the",
"autoload",
"of",
"the",
"dictionary",
"@param",
"config",
"@param",
"sync",
"@param",
"loadDic",
"whether",
"check",
"and",
"load",
"the",
"lexicon",
"@return",
"IDictionary"
] | public static ADictionary createDefaultDictionary(
SegmenterConfig config, boolean sync, boolean loadDic )
{
final ADictionary dic = (ADictionary) IDictionary.HASHMAP.factory.create(config, sync);
if ( loadDic == false ) {
return dic;
}
try {
/*
* @Note: updated at 2016/07/07
*
* check and load all the lexicons with more than one path
* if specified none lexicon paths (config.getLexiconPath() is null)
* And we directly load the default lexicons that in the class path
*/
String[] lexpath = config.getLexiconPath();
if ( lexpath == null ) {
dic.loadClassPath();
} else {
for ( String lpath : lexpath ) dic.loadDirectory(lpath);
if ( config.isAutoload() ) dic.startAutoload();
}
/*
* added at 2017/06/10
* check and reset synonyms net of the current Dictionary
*/
dic.resetSynonymsNet();
} catch (IOException e) {
e.printStackTrace();
}
return dic;
} | [
"public",
"static",
"ADictionary",
"createDefaultDictionary",
"(",
"SegmenterConfig",
"config",
",",
"boolean",
"sync",
",",
"boolean",
"loadDic",
")",
"{",
"final",
"ADictionary",
"dic",
"=",
"(",
"ADictionary",
")",
"IDictionary",
".",
"HASHMAP",
".",
"factory",
".",
"create",
"(",
"config",
",",
"sync",
")",
";",
"if",
"(",
"loadDic",
"==",
"false",
")",
"{",
"return",
"dic",
";",
"}",
"try",
"{",
"/*\n * @Note: updated at 2016/07/07\n * \n * check and load all the lexicons with more than one path\n * if specified none lexicon paths (config.getLexiconPath() is null)\n * And we directly load the default lexicons that in the class path\n */",
"String",
"[",
"]",
"lexpath",
"=",
"config",
".",
"getLexiconPath",
"(",
")",
";",
"if",
"(",
"lexpath",
"==",
"null",
")",
"{",
"dic",
".",
"loadClassPath",
"(",
")",
";",
"}",
"else",
"{",
"for",
"(",
"String",
"lpath",
":",
"lexpath",
")",
"dic",
".",
"loadDirectory",
"(",
"lpath",
")",
";",
"if",
"(",
"config",
".",
"isAutoload",
"(",
")",
")",
"dic",
".",
"startAutoload",
"(",
")",
";",
"}",
"/*\n * added at 2017/06/10\n * check and reset synonyms net of the current Dictionary \n */",
"dic",
".",
"resetSynonymsNet",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"dic",
";",
"}"
] | create a default ADictionary instance:
1. check the lexicon path and load the lexicons
if it is null and default to load the lexicon in the classpath
2. check and start the autoload of the dictionary | [
"create",
"a",
"default",
"ADictionary",
"instance",
":",
"1",
".",
"check",
"the",
"lexicon",
"path",
"and",
"load",
"the",
"lexicons",
"if",
"it",
"is",
"null",
"and",
"default",
"to",
"load",
"the",
"lexicon",
"in",
"the",
"classpath",
"2",
".",
"check",
"and",
"start",
"the",
"autoload",
"of",
"the",
"dictionary"
] | [] | [
{
"param": "config",
"type": "SegmenterConfig"
},
{
"param": "sync",
"type": "boolean"
},
{
"param": "loadDic",
"type": "boolean"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": "SegmenterConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sync",
"type": "boolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "loadDic",
"type": "boolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
432,
10905,
27346,
10905,
12,
7010,
5411,
10807,
264,
809,
642,
16,
1250,
3792,
16,
1250,
1262,
40,
335,
262,
7010,
565,
288,
203,
3639,
727,
432,
10905,
11681,
273,
261,
1880,
3192,
13,
1599,
3192,
18,
15920,
8352,
18,
6848,
18,
2640,
12,
1425,
16,
3792,
1769,
203,
3639,
309,
261,
1262,
40,
335,
422,
629,
262,
288,
203,
5411,
327,
11681,
31,
203,
3639,
289,
203,
540,
203,
3639,
775,
288,
203,
5411,
1748,
203,
2398,
380,
632,
8067,
30,
3526,
622,
12659,
19,
8642,
19,
8642,
203,
2398,
380,
7010,
2398,
380,
866,
471,
1262,
777,
326,
5275,
14516,
598,
1898,
2353,
1245,
589,
203,
2398,
380,
309,
1269,
6555,
31681,
2953,
261,
1425,
18,
588,
21743,
743,
1435,
353,
446,
13,
203,
2398,
380,
7835,
732,
5122,
1262,
326,
805,
5275,
14516,
716,
316,
326,
667,
589,
203,
5411,
1195,
203,
5411,
514,
8526,
5275,
803,
273,
642,
18,
588,
21743,
743,
5621,
203,
5411,
309,
261,
5275,
803,
422,
446,
262,
288,
203,
2398,
202,
15859,
18,
945,
22158,
5621,
203,
5411,
289,
469,
288,
203,
7734,
364,
261,
514,
328,
803,
294,
5275,
803,
262,
11681,
18,
945,
2853,
12,
80,
803,
1769,
203,
7734,
309,
261,
642,
18,
291,
7150,
10565,
1435,
262,
11681,
18,
1937,
7150,
10565,
5621,
203,
5411,
289,
203,
2398,
203,
5411,
1748,
203,
2398,
380,
3096,
622,
11015,
19,
7677,
19,
2163,
203,
2398,
380,
866,
471,
2715,
27260,
2901,
434,
326,
783,
16447,
7010,
5411,
1195,
203,
5411,
11681,
18,
6208,
10503,
16968,
7308,
5621,
203,
3639,
289,
1044,
261,
14106,
425,
13,
288,
203,
5411,
425,
18,
1188,
6332,
5621,
203,
3639,
289,
203,
540,
203,
3639,
327,
11681,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
752,
279,
805,
432,
10905,
791,
30,
203,
377,
380,
404,
18,
866,
326,
31681,
589,
471,
1262,
326,
5275,
14516,
203,
377,
380,
225,
309,
518,
353,
446,
471,
805,
358,
1262,
326,
31681,
316,
326,
10006,
203,
377,
380,
576,
18,
866,
471,
787,
326,
16674,
434,
326,
3880,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
642,
203,
377,
380,
632,
891,
282,
3792,
203,
377,
380,
632,
891,
282,
1262,
40,
335,
2856,
866,
471,
1262,
326,
31681,
203,
377,
380,
632,
2463,
225,
1599,
3192,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
65858bbc232eff10e7bce7a7590af8aaaa2bacd4 | passerbya/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/dic/DictionaryFactory.java | [
"Apache-2.0"
] | Java | createSingletonDictionary | ADictionary | public static ADictionary createSingletonDictionary(SegmenterConfig config, boolean loadDic)
{
synchronized (LOCK) {
if ( singletonDic == null ) {
singletonDic = createDefaultDictionary(config, loadDic);
}
}
return singletonDic;
} | /**
* create a singleton ADictionary object according to the JcsegTaskConfig
*
* @param config
* @param loadDic
* @return ADictionary
*/ | create a singleton ADictionary object according to the JcsegTaskConfig
@param config
@param loadDic
@return ADictionary | [
"create",
"a",
"singleton",
"ADictionary",
"object",
"according",
"to",
"the",
"JcsegTaskConfig",
"@param",
"config",
"@param",
"loadDic",
"@return",
"ADictionary"
] | public static ADictionary createSingletonDictionary(SegmenterConfig config, boolean loadDic)
{
synchronized (LOCK) {
if ( singletonDic == null ) {
singletonDic = createDefaultDictionary(config, loadDic);
}
}
return singletonDic;
} | [
"public",
"static",
"ADictionary",
"createSingletonDictionary",
"(",
"SegmenterConfig",
"config",
",",
"boolean",
"loadDic",
")",
"{",
"synchronized",
"(",
"LOCK",
")",
"{",
"if",
"(",
"singletonDic",
"==",
"null",
")",
"{",
"singletonDic",
"=",
"createDefaultDictionary",
"(",
"config",
",",
"loadDic",
")",
";",
"}",
"}",
"return",
"singletonDic",
";",
"}"
] | create a singleton ADictionary object according to the JcsegTaskConfig | [
"create",
"a",
"singleton",
"ADictionary",
"object",
"according",
"to",
"the",
"JcsegTaskConfig"
] | [] | [
{
"param": "config",
"type": "SegmenterConfig"
},
{
"param": "loadDic",
"type": "boolean"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": "SegmenterConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "loadDic",
"type": "boolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
432,
10905,
752,
19571,
10905,
12,
4131,
264,
809,
642,
16,
1250,
1262,
40,
335,
13,
203,
565,
288,
203,
3639,
3852,
261,
6589,
13,
288,
203,
5411,
309,
261,
6396,
40,
335,
422,
446,
262,
288,
203,
7734,
6396,
40,
335,
273,
27346,
10905,
12,
1425,
16,
1262,
40,
335,
1769,
203,
5411,
289,
203,
3639,
289,
203,
540,
203,
3639,
327,
6396,
40,
335,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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358,
326,
804,
71,
5680,
2174,
809,
203,
377,
380,
7010,
377,
380,
632,
891,
282,
642,
203,
377,
380,
632,
891,
282,
1262,
40,
335,
203,
377,
380,
632,
2463,
225,
432,
10905,
203,
565,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
cf02211098f6b78db7f1a67e79ae795cb79a5fd2 | zhangchenbocalvin/stackelberg-pricing-games | PlayerMoving.java | [
"MIT"
] | Java | proceedNewDay | null | @Override
public void proceedNewDay(int p_date) throws RemoteException {
// update data array
if (p_date > 101) {
this.data.add(m_platformStub.query(this.m_type, p_date - 1));
profitAccumulation += computeProfitOnDay(p_date - 1);
}
// estimate the coefficient for the reaction function
estimateReaction();
// estimated reaction
double u_l = (0.3 * (this.b_star - this.a_star) - 3) / (2 * ((0.3 * this.b_star - 1)));
double u_f = (this.a_star + this.b_star * u_l);
expectedUF.add(u_f);
expectedProfit += dailyProfit(u_l, u_f, 1);
m_platformStub.publishPrice(m_type, (float) u_l);
} | /**
* To inform this instance to proceed to a new simulation day
* @param p_date The date of the new day
* @throws RemoteException This exception *MUST* be thrown by this method
*/ | To inform this instance to proceed to a new simulation day
@param p_date The date of the new day
@throws RemoteException This exception *MUST* be thrown by this method | [
"To",
"inform",
"this",
"instance",
"to",
"proceed",
"to",
"a",
"new",
"simulation",
"day",
"@param",
"p_date",
"The",
"date",
"of",
"the",
"new",
"day",
"@throws",
"RemoteException",
"This",
"exception",
"*",
"MUST",
"*",
"be",
"thrown",
"by",
"this",
"method"
] | @Override
public void proceedNewDay(int p_date) throws RemoteException {
if (p_date > 101) {
this.data.add(m_platformStub.query(this.m_type, p_date - 1));
profitAccumulation += computeProfitOnDay(p_date - 1);
}
estimateReaction();
double u_l = (0.3 * (this.b_star - this.a_star) - 3) / (2 * ((0.3 * this.b_star - 1)));
double u_f = (this.a_star + this.b_star * u_l);
expectedUF.add(u_f);
expectedProfit += dailyProfit(u_l, u_f, 1);
m_platformStub.publishPrice(m_type, (float) u_l);
} | [
"@",
"Override",
"public",
"void",
"proceedNewDay",
"(",
"int",
"p_date",
")",
"throws",
"RemoteException",
"{",
"if",
"(",
"p_date",
">",
"101",
")",
"{",
"this",
".",
"data",
".",
"add",
"(",
"m_platformStub",
".",
"query",
"(",
"this",
".",
"m_type",
",",
"p_date",
"-",
"1",
")",
")",
";",
"profitAccumulation",
"+=",
"computeProfitOnDay",
"(",
"p_date",
"-",
"1",
")",
";",
"}",
"estimateReaction",
"(",
")",
";",
"double",
"u_l",
"=",
"(",
"0.3",
"*",
"(",
"this",
".",
"b_star",
"-",
"this",
".",
"a_star",
")",
"-",
"3",
")",
"/",
"(",
"2",
"*",
"(",
"(",
"0.3",
"*",
"this",
".",
"b_star",
"-",
"1",
")",
")",
")",
";",
"double",
"u_f",
"=",
"(",
"this",
".",
"a_star",
"+",
"this",
".",
"b_star",
"*",
"u_l",
")",
";",
"expectedUF",
".",
"add",
"(",
"u_f",
")",
";",
"expectedProfit",
"+=",
"dailyProfit",
"(",
"u_l",
",",
"u_f",
",",
"1",
")",
";",
"m_platformStub",
".",
"publishPrice",
"(",
"m_type",
",",
"(",
"float",
")",
"u_l",
")",
";",
"}"
] | To inform this instance to proceed to a new simulation day
@param p_date The date of the new day
@throws RemoteException This exception *MUST* be thrown by this method | [
"To",
"inform",
"this",
"instance",
"to",
"proceed",
"to",
"a",
"new",
"simulation",
"day",
"@param",
"p_date",
"The",
"date",
"of",
"the",
"new",
"day",
"@throws",
"RemoteException",
"This",
"exception",
"*",
"MUST",
"*",
"be",
"thrown",
"by",
"this",
"method"
] | [
"// update data array\r",
"// estimate the coefficient for the reaction function\r",
"// estimated reaction\r"
] | [
{
"param": "p_date",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p_date",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
206,
203,
202,
482,
918,
11247,
1908,
4245,
12,
474,
293,
67,
712,
13,
1216,
18361,
288,
206,
203,
202,
202,
759,
1089,
501,
526,
206,
203,
202,
202,
430,
261,
84,
67,
712,
405,
13822,
13,
288,
206,
203,
1082,
202,
2211,
18,
892,
18,
1289,
12,
81,
67,
9898,
11974,
18,
2271,
12,
2211,
18,
81,
67,
723,
16,
293,
67,
712,
300,
404,
10019,
206,
203,
1082,
202,
685,
7216,
8973,
5283,
367,
1011,
3671,
626,
7216,
1398,
4245,
12,
84,
67,
712,
300,
404,
1769,
206,
203,
202,
202,
97,
206,
203,
206,
203,
202,
202,
759,
11108,
326,
16554,
364,
326,
12836,
445,
206,
203,
202,
202,
23562,
21581,
5621,
206,
203,
206,
203,
202,
202,
759,
13137,
12836,
206,
203,
202,
202,
9056,
582,
67,
80,
273,
261,
20,
18,
23,
380,
261,
2211,
18,
70,
67,
10983,
300,
333,
18,
69,
67,
10983,
13,
300,
890,
13,
342,
261,
22,
380,
14015,
20,
18,
23,
380,
333,
18,
70,
67,
10983,
300,
404,
3719,
1769,
206,
203,
202,
202,
9056,
582,
67,
74,
273,
261,
2211,
18,
69,
67,
10983,
397,
333,
18,
70,
67,
10983,
380,
582,
67,
80,
1769,
206,
203,
202,
202,
3825,
57,
42,
18,
1289,
12,
89,
67,
74,
1769,
206,
203,
202,
202,
3825,
626,
7216,
1011,
18872,
626,
7216,
12,
89,
67,
80,
16,
582,
67,
74,
16,
404,
1769,
206,
203,
1082,
206,
203,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
206,
203,
202,
380,
2974,
13235,
333,
791,
358,
11247,
358,
279,
394,
14754,
2548,
206,
203,
202,
380,
632,
891,
293,
67,
712,
1021,
1509,
434,
326,
394,
2548,
206,
203,
202,
380,
632,
15069,
18361,
1220,
1520,
380,
49,
5996,
14,
506,
6718,
635,
333,
707,
206,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7d4777961d879db12922d984d97242cabd8c6349 | zhangchenbocalvin/stackelberg-pricing-games | PlayerPolly.java | [
"MIT"
] | Java | proceedNewDay | null | @Override
public void proceedNewDay(int p_date) throws RemoteException {
// update data array
if (p_date > 101) {
this.data.add(m_platformStub.query(this.m_type, p_date - 1));
profitAccumulation += computeProfitOnDay(p_date - 1);
}
int array_length = this.data.size();
double[] x = new double[array_length];
double[] y = new double[array_length];
for (int i = 0; i < array_length; i++) {
Record record = data.get(i);
x[i] = record.m_leaderPrice;
y[i] = record.m_followerPrice;
}
regression = new PolynomialRegression(x, y, degree);
// estimated reaction
double[] predictedLP = getPredictedLeaderPrice(p_date, 2);
double eProfit = predictedLP[0];
double u_l = predictedLP[1];
double u_f = predictedLP[2];
expectedUF.add(u_f);
expectedProfit += eProfit;
m_platformStub.publishPrice(m_type, (float) u_l);
} | /**
* To inform this instance to proceed to a new simulation day
* @param p_date The date of the new day
* @throws RemoteException This exception *MUST* be thrown by this method
*/ | To inform this instance to proceed to a new simulation day
@param p_date The date of the new day
@throws RemoteException This exception *MUST* be thrown by this method | [
"To",
"inform",
"this",
"instance",
"to",
"proceed",
"to",
"a",
"new",
"simulation",
"day",
"@param",
"p_date",
"The",
"date",
"of",
"the",
"new",
"day",
"@throws",
"RemoteException",
"This",
"exception",
"*",
"MUST",
"*",
"be",
"thrown",
"by",
"this",
"method"
] | @Override
public void proceedNewDay(int p_date) throws RemoteException {
if (p_date > 101) {
this.data.add(m_platformStub.query(this.m_type, p_date - 1));
profitAccumulation += computeProfitOnDay(p_date - 1);
}
int array_length = this.data.size();
double[] x = new double[array_length];
double[] y = new double[array_length];
for (int i = 0; i < array_length; i++) {
Record record = data.get(i);
x[i] = record.m_leaderPrice;
y[i] = record.m_followerPrice;
}
regression = new PolynomialRegression(x, y, degree);
double[] predictedLP = getPredictedLeaderPrice(p_date, 2);
double eProfit = predictedLP[0];
double u_l = predictedLP[1];
double u_f = predictedLP[2];
expectedUF.add(u_f);
expectedProfit += eProfit;
m_platformStub.publishPrice(m_type, (float) u_l);
} | [
"@",
"Override",
"public",
"void",
"proceedNewDay",
"(",
"int",
"p_date",
")",
"throws",
"RemoteException",
"{",
"if",
"(",
"p_date",
">",
"101",
")",
"{",
"this",
".",
"data",
".",
"add",
"(",
"m_platformStub",
".",
"query",
"(",
"this",
".",
"m_type",
",",
"p_date",
"-",
"1",
")",
")",
";",
"profitAccumulation",
"+=",
"computeProfitOnDay",
"(",
"p_date",
"-",
"1",
")",
";",
"}",
"int",
"array_length",
"=",
"this",
".",
"data",
".",
"size",
"(",
")",
";",
"double",
"[",
"]",
"x",
"=",
"new",
"double",
"[",
"array_length",
"]",
";",
"double",
"[",
"]",
"y",
"=",
"new",
"double",
"[",
"array_length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array_length",
";",
"i",
"++",
")",
"{",
"Record",
"record",
"=",
"data",
".",
"get",
"(",
"i",
")",
";",
"x",
"[",
"i",
"]",
"=",
"record",
".",
"m_leaderPrice",
";",
"y",
"[",
"i",
"]",
"=",
"record",
".",
"m_followerPrice",
";",
"}",
"regression",
"=",
"new",
"PolynomialRegression",
"(",
"x",
",",
"y",
",",
"degree",
")",
";",
"double",
"[",
"]",
"predictedLP",
"=",
"getPredictedLeaderPrice",
"(",
"p_date",
",",
"2",
")",
";",
"double",
"eProfit",
"=",
"predictedLP",
"[",
"0",
"]",
";",
"double",
"u_l",
"=",
"predictedLP",
"[",
"1",
"]",
";",
"double",
"u_f",
"=",
"predictedLP",
"[",
"2",
"]",
";",
"expectedUF",
".",
"add",
"(",
"u_f",
")",
";",
"expectedProfit",
"+=",
"eProfit",
";",
"m_platformStub",
".",
"publishPrice",
"(",
"m_type",
",",
"(",
"float",
")",
"u_l",
")",
";",
"}"
] | To inform this instance to proceed to a new simulation day
@param p_date The date of the new day
@throws RemoteException This exception *MUST* be thrown by this method | [
"To",
"inform",
"this",
"instance",
"to",
"proceed",
"to",
"a",
"new",
"simulation",
"day",
"@param",
"p_date",
"The",
"date",
"of",
"the",
"new",
"day",
"@throws",
"RemoteException",
"This",
"exception",
"*",
"MUST",
"*",
"be",
"thrown",
"by",
"this",
"method"
] | [
"// update data array\r",
"// estimated reaction\r"
] | [
{
"param": "p_date",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p_date",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
206,
203,
202,
482,
918,
11247,
1908,
4245,
12,
474,
293,
67,
712,
13,
1216,
18361,
288,
206,
203,
206,
203,
202,
202,
759,
1089,
501,
526,
206,
203,
202,
202,
430,
261,
84,
67,
712,
405,
13822,
13,
288,
206,
203,
1082,
202,
2211,
18,
892,
18,
1289,
12,
81,
67,
9898,
11974,
18,
2271,
12,
2211,
18,
81,
67,
723,
16,
293,
67,
712,
300,
404,
10019,
206,
203,
1082,
202,
685,
7216,
8973,
5283,
367,
1011,
3671,
626,
7216,
1398,
4245,
12,
84,
67,
712,
300,
404,
1769,
206,
203,
202,
202,
97,
206,
203,
206,
203,
3639,
509,
526,
67,
2469,
273,
333,
18,
892,
18,
1467,
5621,
206,
203,
3639,
1645,
8526,
619,
273,
394,
1645,
63,
1126,
67,
2469,
15533,
206,
203,
3639,
1645,
8526,
677,
273,
394,
1645,
63,
1126,
67,
2469,
15533,
206,
203,
206,
203,
3639,
364,
261,
474,
277,
273,
374,
31,
277,
411,
526,
67,
2469,
31,
277,
27245,
288,
206,
203,
5411,
5059,
1409,
273,
501,
18,
588,
12,
77,
1769,
206,
203,
5411,
619,
63,
77,
65,
273,
1409,
18,
81,
67,
27863,
5147,
31,
206,
203,
5411,
677,
63,
77,
65,
273,
1409,
18,
81,
67,
14641,
264,
5147,
31,
206,
203,
3639,
289,
206,
203,
206,
203,
3639,
23215,
273,
394,
6730,
13602,
1617,
16345,
12,
92,
16,
677,
16,
10782,
1769,
206,
203,
540,
206,
203,
202,
202,
759,
13137,
12836,
206,
203,
202,
202,
9056,
8526,
15071,
14461,
273,
1689,
1118,
933,
329,
15254,
5147,
12,
84,
67,
712,
16,
576,
1769,
206,
203,
202,
202,
9056,
425,
626,
7216,
273,
15071,
14461,
63,
20,
15533,
206,
203,
202,
202,
9056,
582,
67,
80,
273,
15071,
14461,
63,
21,
15533,
206,
203,
202,
202,
9056,
582,
67,
74,
273,
15071,
14461,
63,
22,
15533,
206,
203,
206,
203,
202,
202,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
206,
203,
202,
380,
2974,
13235,
333,
791,
358,
11247,
358,
279,
394,
14754,
2548,
206,
203,
202,
380,
632,
891,
293,
67,
712,
1021,
1509,
434,
326,
394,
2548,
206,
203,
202,
380,
632,
15069,
18361,
1220,
1520,
380,
49,
5996,
14,
506,
6718,
635,
333,
707,
206,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
72590bcfc0e9c0254ab1b1eb640a29ad45df1fe3 | zhangchenbocalvin/stackelberg-pricing-games | src/PlayerImpl.java | [
"MIT"
] | Java | registerRMI | null | private void registerRMI() throws RemoteException {
final Player l_playerStub = (Player) UnicastRemoteObject.exportObject(this, 0);
final Registry l_registry = LocateRegistry.getRegistry();
l_registry.rebind(m_type.toString(), l_playerStub);
} | /**
* Register this instance to RMI registry
* @throws RemoteException
*/ | Register this instance to RMI registry
@throws RemoteException | [
"Register",
"this",
"instance",
"to",
"RMI",
"registry",
"@throws",
"RemoteException"
] | private void registerRMI() throws RemoteException {
final Player l_playerStub = (Player) UnicastRemoteObject.exportObject(this, 0);
final Registry l_registry = LocateRegistry.getRegistry();
l_registry.rebind(m_type.toString(), l_playerStub);
} | [
"private",
"void",
"registerRMI",
"(",
")",
"throws",
"RemoteException",
"{",
"final",
"Player",
"l_playerStub",
"=",
"(",
"Player",
")",
"UnicastRemoteObject",
".",
"exportObject",
"(",
"this",
",",
"0",
")",
";",
"final",
"Registry",
"l_registry",
"=",
"LocateRegistry",
".",
"getRegistry",
"(",
")",
";",
"l_registry",
".",
"rebind",
"(",
"m_type",
".",
"toString",
"(",
")",
",",
"l_playerStub",
")",
";",
"}"
] | Register this instance to RMI registry
@throws RemoteException | [
"Register",
"this",
"instance",
"to",
"RMI",
"registry",
"@throws",
"RemoteException"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
918,
1744,
54,
7492,
1435,
1216,
18361,
288,
203,
202,
202,
6385,
19185,
328,
67,
14872,
11974,
273,
261,
12148,
13,
1351,
12544,
5169,
921,
18,
6530,
921,
12,
2211,
16,
374,
1769,
203,
202,
202,
6385,
5438,
328,
67,
9893,
273,
2851,
340,
4243,
18,
588,
4243,
5621,
203,
202,
202,
80,
67,
9893,
18,
266,
4376,
12,
81,
67,
723,
18,
10492,
9334,
328,
67,
14872,
11974,
1769,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
5433,
333,
791,
358,
534,
7492,
4023,
203,
202,
380,
632,
15069,
18361,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
72590bcfc0e9c0254ab1b1eb640a29ad45df1fe3 | zhangchenbocalvin/stackelberg-pricing-games | src/PlayerImpl.java | [
"MIT"
] | Java | registerPlatform | null | private void registerPlatform(final String p_displayName) throws RemoteException, NotBoundException {
final Registry l_registry = LocateRegistry.getRegistry();
m_platformStub = (Platform) l_registry.lookup("Platform");
m_platformStub.registerPlayer(m_type, p_displayName);
} | /**
* Get the stub of the platform, then call its initialization method to make
* it get the stub of this player
* @param p_displayName The name to be displayed in GUI
* @throws RemoteException
* @throws NotBoundException
*/ | Get the stub of the platform, then call its initialization method to make
it get the stub of this player
@param p_displayName The name to be displayed in GUI
@throws RemoteException
@throws NotBoundException | [
"Get",
"the",
"stub",
"of",
"the",
"platform",
"then",
"call",
"its",
"initialization",
"method",
"to",
"make",
"it",
"get",
"the",
"stub",
"of",
"this",
"player",
"@param",
"p_displayName",
"The",
"name",
"to",
"be",
"displayed",
"in",
"GUI",
"@throws",
"RemoteException",
"@throws",
"NotBoundException"
] | private void registerPlatform(final String p_displayName) throws RemoteException, NotBoundException {
final Registry l_registry = LocateRegistry.getRegistry();
m_platformStub = (Platform) l_registry.lookup("Platform");
m_platformStub.registerPlayer(m_type, p_displayName);
} | [
"private",
"void",
"registerPlatform",
"(",
"final",
"String",
"p_displayName",
")",
"throws",
"RemoteException",
",",
"NotBoundException",
"{",
"final",
"Registry",
"l_registry",
"=",
"LocateRegistry",
".",
"getRegistry",
"(",
")",
";",
"m_platformStub",
"=",
"(",
"Platform",
")",
"l_registry",
".",
"lookup",
"(",
"\"Platform\"",
")",
";",
"m_platformStub",
".",
"registerPlayer",
"(",
"m_type",
",",
"p_displayName",
")",
";",
"}"
] | Get the stub of the platform, then call its initialization method to make
it get the stub of this player
@param p_displayName The name to be displayed in GUI
@throws RemoteException
@throws NotBoundException | [
"Get",
"the",
"stub",
"of",
"the",
"platform",
"then",
"call",
"its",
"initialization",
"method",
"to",
"make",
"it",
"get",
"the",
"stub",
"of",
"this",
"player",
"@param",
"p_displayName",
"The",
"name",
"to",
"be",
"displayed",
"in",
"GUI",
"@throws",
"RemoteException",
"@throws",
"NotBoundException"
] | [] | [
{
"param": "p_displayName",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p_displayName",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
918,
1744,
8201,
12,
6385,
514,
293,
67,
5417,
461,
13,
1216,
18361,
16,
2288,
3499,
503,
288,
203,
202,
202,
6385,
5438,
328,
67,
9893,
273,
2851,
340,
4243,
18,
588,
4243,
5621,
203,
202,
202,
81,
67,
9898,
11974,
273,
261,
8201,
13,
328,
67,
9893,
18,
8664,
2932,
8201,
8863,
203,
202,
202,
81,
67,
9898,
11974,
18,
4861,
12148,
12,
81,
67,
723,
16,
293,
67,
5417,
461,
1769,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
968,
326,
7168,
434,
326,
4072,
16,
1508,
745,
2097,
10313,
707,
358,
1221,
203,
202,
380,
518,
336,
326,
7168,
434,
333,
7291,
203,
202,
380,
632,
891,
293,
67,
5417,
461,
1021,
508,
358,
506,
10453,
316,
10978,
203,
202,
380,
632,
15069,
18361,
203,
202,
380,
632,
15069,
2288,
3499,
503,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
72590bcfc0e9c0254ab1b1eb640a29ad45df1fe3 | zhangchenbocalvin/stackelberg-pricing-games | src/PlayerImpl.java | [
"MIT"
] | Java | startSimulation | null | @Override
public void startSimulation(int p_steps)
throws RemoteException
{
m_platformStub.log(m_type, "startSimulation(): Not supported yet.");
} | /**
* To inform this instance the start of the simulation
* @param p_steps Indicates how many steps will this round of simulation perform
* @throws RemoteException
*/ | To inform this instance the start of the simulation
@param p_steps Indicates how many steps will this round of simulation perform
@throws RemoteException | [
"To",
"inform",
"this",
"instance",
"the",
"start",
"of",
"the",
"simulation",
"@param",
"p_steps",
"Indicates",
"how",
"many",
"steps",
"will",
"this",
"round",
"of",
"simulation",
"perform",
"@throws",
"RemoteException"
] | @Override
public void startSimulation(int p_steps)
throws RemoteException
{
m_platformStub.log(m_type, "startSimulation(): Not supported yet.");
} | [
"@",
"Override",
"public",
"void",
"startSimulation",
"(",
"int",
"p_steps",
")",
"throws",
"RemoteException",
"{",
"m_platformStub",
".",
"log",
"(",
"m_type",
",",
"\"startSimulation(): Not supported yet.\"",
")",
";",
"}"
] | To inform this instance the start of the simulation
@param p_steps Indicates how many steps will this round of simulation perform
@throws RemoteException | [
"To",
"inform",
"this",
"instance",
"the",
"start",
"of",
"the",
"simulation",
"@param",
"p_steps",
"Indicates",
"how",
"many",
"steps",
"will",
"this",
"round",
"of",
"simulation",
"perform",
"@throws",
"RemoteException"
] | [] | [
{
"param": "p_steps",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p_steps",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
202,
482,
918,
787,
18419,
12,
474,
293,
67,
8986,
13,
203,
202,
202,
15069,
18361,
203,
202,
95,
203,
202,
202,
81,
67,
9898,
11974,
18,
1330,
12,
81,
67,
723,
16,
315,
1937,
18419,
13332,
2288,
3260,
4671,
1199,
1769,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
2974,
13235,
333,
791,
326,
787,
434,
326,
14754,
203,
202,
380,
632,
891,
293,
67,
8986,
18336,
3661,
4906,
6075,
903,
333,
3643,
434,
14754,
3073,
203,
202,
380,
632,
15069,
18361,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
72590bcfc0e9c0254ab1b1eb640a29ad45df1fe3 | zhangchenbocalvin/stackelberg-pricing-games | src/PlayerImpl.java | [
"MIT"
] | Java | endSimulation | null | @Override
public void endSimulation()
throws RemoteException
{
m_platformStub.log(m_type, "endSimulation(): Not supported yet.");
} | /**
* To inform this instance the end of the simulation
* @throws RemoteException
*/ | To inform this instance the end of the simulation
@throws RemoteException | [
"To",
"inform",
"this",
"instance",
"the",
"end",
"of",
"the",
"simulation",
"@throws",
"RemoteException"
] | @Override
public void endSimulation()
throws RemoteException
{
m_platformStub.log(m_type, "endSimulation(): Not supported yet.");
} | [
"@",
"Override",
"public",
"void",
"endSimulation",
"(",
")",
"throws",
"RemoteException",
"{",
"m_platformStub",
".",
"log",
"(",
"m_type",
",",
"\"endSimulation(): Not supported yet.\"",
")",
";",
"}"
] | To inform this instance the end of the simulation
@throws RemoteException | [
"To",
"inform",
"this",
"instance",
"the",
"end",
"of",
"the",
"simulation",
"@throws",
"RemoteException"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
202,
482,
918,
679,
18419,
1435,
203,
202,
202,
15069,
18361,
203,
202,
95,
203,
202,
202,
81,
67,
9898,
11974,
18,
1330,
12,
81,
67,
723,
16,
315,
409,
18419,
13332,
2288,
3260,
4671,
1199,
1769,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
2974,
13235,
333,
791,
326,
679,
434,
326,
14754,
203,
202,
380,
632,
15069,
18361,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
72590bcfc0e9c0254ab1b1eb640a29ad45df1fe3 | zhangchenbocalvin/stackelberg-pricing-games | src/PlayerImpl.java | [
"MIT"
] | Java | goodbye | null | @Override
public void goodbye()
throws RemoteException
{
m_platformStub.log(m_type, "goodbye(): Not supported yet.");
} | /**
* To inform this instance the end of the session
* @throws RemoteException
*/ | To inform this instance the end of the session
@throws RemoteException | [
"To",
"inform",
"this",
"instance",
"the",
"end",
"of",
"the",
"session",
"@throws",
"RemoteException"
] | @Override
public void goodbye()
throws RemoteException
{
m_platformStub.log(m_type, "goodbye(): Not supported yet.");
} | [
"@",
"Override",
"public",
"void",
"goodbye",
"(",
")",
"throws",
"RemoteException",
"{",
"m_platformStub",
".",
"log",
"(",
"m_type",
",",
"\"goodbye(): Not supported yet.\"",
")",
";",
"}"
] | To inform this instance the end of the session
@throws RemoteException | [
"To",
"inform",
"this",
"instance",
"the",
"end",
"of",
"the",
"session",
"@throws",
"RemoteException"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
202,
482,
918,
7494,
1637,
73,
1435,
203,
202,
202,
15069,
18361,
203,
202,
95,
203,
202,
202,
81,
67,
9898,
11974,
18,
1330,
12,
81,
67,
723,
16,
315,
19747,
1637,
73,
13332,
2288,
3260,
4671,
1199,
1769,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
2974,
13235,
333,
791,
326,
679,
434,
326,
1339,
203,
202,
380,
632,
15069,
18361,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
6a14a987430e93a1f6a34c66ce65dc219abc320b | zhangchenbocalvin/stackelberg-pricing-games | src/PseudoLeader.java | [
"MIT"
] | Java | checkConnection | null | @Override
public void checkConnection()
throws RemoteException
{
super.checkConnection();
//TO DO: delete the line above and put your own code here
} | /**
* You may want to delete this method if you don't want modify
* the original connection checking behavior of the platform.
* Actually I recommend you to delete this method from your own code
* @throws RemoteException If implemented, the RemoteException *MUST* be
* thrown by this method
*/ | You may want to delete this method if you don't want modify
the original connection checking behavior of the platform.
Actually I recommend you to delete this method from your own code
@throws RemoteException If implemented, the RemoteException *MUST* be
thrown by this method | [
"You",
"may",
"want",
"to",
"delete",
"this",
"method",
"if",
"you",
"don",
"'",
"t",
"want",
"modify",
"the",
"original",
"connection",
"checking",
"behavior",
"of",
"the",
"platform",
".",
"Actually",
"I",
"recommend",
"you",
"to",
"delete",
"this",
"method",
"from",
"your",
"own",
"code",
"@throws",
"RemoteException",
"If",
"implemented",
"the",
"RemoteException",
"*",
"MUST",
"*",
"be",
"thrown",
"by",
"this",
"method"
] | @Override
public void checkConnection()
throws RemoteException
{
super.checkConnection();
} | [
"@",
"Override",
"public",
"void",
"checkConnection",
"(",
")",
"throws",
"RemoteException",
"{",
"super",
".",
"checkConnection",
"(",
")",
";",
"}"
] | You may want to delete this method if you don't want modify
the original connection checking behavior of the platform. | [
"You",
"may",
"want",
"to",
"delete",
"this",
"method",
"if",
"you",
"don",
"'",
"t",
"want",
"modify",
"the",
"original",
"connection",
"checking",
"behavior",
"of",
"the",
"platform",
"."
] | [
"//TO DO: delete the line above and put your own code here\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
206,
203,
202,
482,
918,
866,
1952,
1435,
206,
203,
202,
202,
15069,
18361,
206,
203,
202,
95,
206,
203,
202,
202,
9565,
18,
1893,
1952,
5621,
206,
203,
202,
202,
759,
4296,
5467,
30,
1430,
326,
980,
5721,
471,
1378,
3433,
4953,
981,
2674,
206,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
206,
203,
202,
380,
4554,
2026,
2545,
358,
1430,
333,
707,
309,
1846,
2727,
1404,
2545,
5612,
206,
203,
202,
380,
326,
2282,
1459,
6728,
6885,
434,
326,
4072,
18,
206,
203,
202,
380,
4603,
3452,
467,
22867,
1846,
358,
1430,
333,
707,
628,
3433,
4953,
981,
206,
203,
202,
380,
632,
15069,
18361,
971,
8249,
16,
326,
18361,
380,
49,
5996,
14,
506,
206,
203,
202,
380,
6718,
635,
333,
707,
206,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
6a14a987430e93a1f6a34c66ce65dc219abc320b | zhangchenbocalvin/stackelberg-pricing-games | src/PseudoLeader.java | [
"MIT"
] | Java | goodbye | null | @Override
public void goodbye()
throws RemoteException
{
super.goodbye();
//TO DO: delete the line above and put your own exit code here
} | /**
* You may want to delete this method if you don't want the platform
* to control the exit behavior of your leader class
* @throws RemoteException If implemented, the RemoteException *MUST* be
* thrown by this method
*/ | You may want to delete this method if you don't want the platform
to control the exit behavior of your leader class
@throws RemoteException If implemented, the RemoteException *MUST* be
thrown by this method | [
"You",
"may",
"want",
"to",
"delete",
"this",
"method",
"if",
"you",
"don",
"'",
"t",
"want",
"the",
"platform",
"to",
"control",
"the",
"exit",
"behavior",
"of",
"your",
"leader",
"class",
"@throws",
"RemoteException",
"If",
"implemented",
"the",
"RemoteException",
"*",
"MUST",
"*",
"be",
"thrown",
"by",
"this",
"method"
] | @Override
public void goodbye()
throws RemoteException
{
super.goodbye();
} | [
"@",
"Override",
"public",
"void",
"goodbye",
"(",
")",
"throws",
"RemoteException",
"{",
"super",
".",
"goodbye",
"(",
")",
";",
"}"
] | You may want to delete this method if you don't want the platform
to control the exit behavior of your leader class
@throws RemoteException If implemented, the RemoteException *MUST* be
thrown by this method | [
"You",
"may",
"want",
"to",
"delete",
"this",
"method",
"if",
"you",
"don",
"'",
"t",
"want",
"the",
"platform",
"to",
"control",
"the",
"exit",
"behavior",
"of",
"your",
"leader",
"class",
"@throws",
"RemoteException",
"If",
"implemented",
"the",
"RemoteException",
"*",
"MUST",
"*",
"be",
"thrown",
"by",
"this",
"method"
] | [
"//TO DO: delete the line above and put your own exit code here\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
206,
203,
202,
482,
918,
7494,
1637,
73,
1435,
206,
203,
202,
202,
15069,
18361,
206,
203,
202,
95,
206,
203,
202,
202,
9565,
18,
19747,
1637,
73,
5621,
206,
203,
202,
202,
759,
4296,
5467,
30,
1430,
326,
980,
5721,
471,
1378,
3433,
4953,
2427,
981,
2674,
206,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
206,
203,
202,
380,
4554,
2026,
2545,
358,
1430,
333,
707,
309,
1846,
2727,
1404,
2545,
326,
4072,
206,
203,
202,
380,
358,
3325,
326,
2427,
6885,
434,
3433,
10302,
667,
206,
203,
202,
380,
632,
15069,
18361,
971,
8249,
16,
326,
18361,
380,
49,
5996,
14,
506,
206,
203,
202,
380,
6718,
635,
333,
707,
206,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
6a14a987430e93a1f6a34c66ce65dc219abc320b | zhangchenbocalvin/stackelberg-pricing-games | src/PseudoLeader.java | [
"MIT"
] | Java | startSimulation | null | @Override
public void startSimulation(int p_steps)
throws RemoteException
{
super.startSimulation(p_steps);
//TO DO: delete the line above and put your own initialization code here
} | /**
* You may want to delete this method if you don't want to do any
* initialization
* @param p_steps Indicates how many steps will the simulation perform
* @throws RemoteException If implemented, the RemoteException *MUST* be
* thrown by this method
*/ | You may want to delete this method if you don't want to do any
initialization
@param p_steps Indicates how many steps will the simulation perform
@throws RemoteException If implemented, the RemoteException *MUST* be
thrown by this method | [
"You",
"may",
"want",
"to",
"delete",
"this",
"method",
"if",
"you",
"don",
"'",
"t",
"want",
"to",
"do",
"any",
"initialization",
"@param",
"p_steps",
"Indicates",
"how",
"many",
"steps",
"will",
"the",
"simulation",
"perform",
"@throws",
"RemoteException",
"If",
"implemented",
"the",
"RemoteException",
"*",
"MUST",
"*",
"be",
"thrown",
"by",
"this",
"method"
] | @Override
public void startSimulation(int p_steps)
throws RemoteException
{
super.startSimulation(p_steps);
} | [
"@",
"Override",
"public",
"void",
"startSimulation",
"(",
"int",
"p_steps",
")",
"throws",
"RemoteException",
"{",
"super",
".",
"startSimulation",
"(",
"p_steps",
")",
";",
"}"
] | You may want to delete this method if you don't want to do any
initialization
@param p_steps Indicates how many steps will the simulation perform
@throws RemoteException If implemented, the RemoteException *MUST* be
thrown by this method | [
"You",
"may",
"want",
"to",
"delete",
"this",
"method",
"if",
"you",
"don",
"'",
"t",
"want",
"to",
"do",
"any",
"initialization",
"@param",
"p_steps",
"Indicates",
"how",
"many",
"steps",
"will",
"the",
"simulation",
"perform",
"@throws",
"RemoteException",
"If",
"implemented",
"the",
"RemoteException",
"*",
"MUST",
"*",
"be",
"thrown",
"by",
"this",
"method"
] | [
"//TO DO: delete the line above and put your own initialization code here\r"
] | [
{
"param": "p_steps",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p_steps",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
206,
203,
202,
482,
918,
787,
18419,
12,
474,
293,
67,
8986,
13,
206,
203,
202,
202,
15069,
18361,
206,
203,
202,
95,
206,
203,
202,
202,
9565,
18,
1937,
18419,
12,
84,
67,
8986,
1769,
206,
203,
202,
202,
759,
4296,
5467,
30,
1430,
326,
980,
5721,
471,
1378,
3433,
4953,
10313,
981,
2674,
206,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
206,
203,
202,
380,
4554,
2026,
2545,
358,
1430,
333,
707,
309,
1846,
2727,
1404,
2545,
358,
741,
1281,
206,
203,
202,
380,
10313,
206,
203,
202,
380,
632,
891,
293,
67,
8986,
18336,
3661,
4906,
6075,
903,
326,
14754,
3073,
206,
203,
202,
380,
632,
15069,
18361,
971,
8249,
16,
326,
18361,
380,
49,
5996,
14,
506,
206,
203,
202,
380,
6718,
635,
333,
707,
206,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
6a14a987430e93a1f6a34c66ce65dc219abc320b | zhangchenbocalvin/stackelberg-pricing-games | src/PseudoLeader.java | [
"MIT"
] | Java | endSimulation | null | @Override
public void endSimulation()
throws RemoteException
{
super.endSimulation();
//TO DO: delete the line above and put your own finalization code here
} | /**
* You may want to delete this method if you don't want to do any
* finalization
* @throws RemoteException If implemented, the RemoteException *MUST* be
* thrown by this method
*/ | You may want to delete this method if you don't want to do any
finalization
@throws RemoteException If implemented, the RemoteException *MUST* be
thrown by this method | [
"You",
"may",
"want",
"to",
"delete",
"this",
"method",
"if",
"you",
"don",
"'",
"t",
"want",
"to",
"do",
"any",
"finalization",
"@throws",
"RemoteException",
"If",
"implemented",
"the",
"RemoteException",
"*",
"MUST",
"*",
"be",
"thrown",
"by",
"this",
"method"
] | @Override
public void endSimulation()
throws RemoteException
{
super.endSimulation();
} | [
"@",
"Override",
"public",
"void",
"endSimulation",
"(",
")",
"throws",
"RemoteException",
"{",
"super",
".",
"endSimulation",
"(",
")",
";",
"}"
] | You may want to delete this method if you don't want to do any
finalization
@throws RemoteException If implemented, the RemoteException *MUST* be
thrown by this method | [
"You",
"may",
"want",
"to",
"delete",
"this",
"method",
"if",
"you",
"don",
"'",
"t",
"want",
"to",
"do",
"any",
"finalization",
"@throws",
"RemoteException",
"If",
"implemented",
"the",
"RemoteException",
"*",
"MUST",
"*",
"be",
"thrown",
"by",
"this",
"method"
] | [
"//TO DO: delete the line above and put your own finalization code here\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
206,
203,
202,
482,
918,
679,
18419,
1435,
206,
203,
202,
202,
15069,
18361,
206,
203,
202,
95,
206,
203,
202,
202,
9565,
18,
409,
18419,
5621,
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
1588,
206,
203,
202,
380,
632,
15069,
18361,
971,
8249,
16,
326,
18361,
380,
49,
5996,
14,
506,
206,
203,
202,
380,
6718,
635,
333,
707,
206,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
6a14a987430e93a1f6a34c66ce65dc219abc320b | zhangchenbocalvin/stackelberg-pricing-games | src/PseudoLeader.java | [
"MIT"
] | Java | proceedNewDay | null | @Override
public void proceedNewDay(int p_date)
throws RemoteException
{
/*
* Check for new price
* Record l_newRecord = m_platformStub.query(m_type, p_date);
*
* Your own math model to compute the price here
* ...
* float l_newPrice = ....
*
* Submit your new price, and end your phase
* m_platformStub.publishPrice(m_type, l_newPrice);
*/
} | /**
* To inform this instance to proceed to a new simulation day
* @param p_date The date of the new day
* @throws RemoteException This exception *MUST* be thrown by this method
*/ | To inform this instance to proceed to a new simulation day
@param p_date The date of the new day
@throws RemoteException This exception *MUST* be thrown by this method | [
"To",
"inform",
"this",
"instance",
"to",
"proceed",
"to",
"a",
"new",
"simulation",
"day",
"@param",
"p_date",
"The",
"date",
"of",
"the",
"new",
"day",
"@throws",
"RemoteException",
"This",
"exception",
"*",
"MUST",
"*",
"be",
"thrown",
"by",
"this",
"method"
] | @Override
public void proceedNewDay(int p_date)
throws RemoteException
{
/*
* Check for new price
* Record l_newRecord = m_platformStub.query(m_type, p_date);
*
* Your own math model to compute the price here
* ...
* float l_newPrice = ....
*
* Submit your new price, and end your phase
* m_platformStub.publishPrice(m_type, l_newPrice);
*/
} | [
"@",
"Override",
"public",
"void",
"proceedNewDay",
"(",
"int",
"p_date",
")",
"throws",
"RemoteException",
"{",
"/*\r\n\t\t * Check for new price\r\n\t\t * Record l_newRecord = m_platformStub.query(m_type, p_date);\r\n\t\t *\r\n\t\t * Your own math model to compute the price here\r\n\t\t * ...\r\n\t\t * float l_newPrice = ....\r\n\t\t *\r\n\t\t * Submit your new price, and end your phase\r\n\t\t * m_platformStub.publishPrice(m_type, l_newPrice);\r\n\t\t */",
"}"
] | To inform this instance to proceed to a new simulation day
@param p_date The date of the new day
@throws RemoteException This exception *MUST* be thrown by this method | [
"To",
"inform",
"this",
"instance",
"to",
"proceed",
"to",
"a",
"new",
"simulation",
"day",
"@param",
"p_date",
"The",
"date",
"of",
"the",
"new",
"day",
"@throws",
"RemoteException",
"This",
"exception",
"*",
"MUST",
"*",
"be",
"thrown",
"by",
"this",
"method"
] | [] | [
{
"param": "p_date",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p_date",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
206,
203,
202,
482,
918,
11247,
1908,
4245,
12,
474,
293,
67,
712,
13,
206,
203,
202,
202,
15069,
18361,
206,
203,
202,
95,
206,
203,
202,
202,
20308,
206,
203,
1082,
380,
2073,
364,
394,
6205,
206,
203,
1082,
380,
5059,
328,
67,
2704,
2115,
273,
312,
67,
9898,
11974,
18,
2271,
12,
81,
67,
723,
16,
293,
67,
712,
1769,
206,
203,
1082,
380,
206,
203,
1082,
380,
20471,
4953,
4233,
938,
358,
3671,
326,
6205,
2674,
206,
203,
1082,
380,
1372,
206,
203,
1082,
380,
1431,
328,
67,
2704,
5147,
273,
1372,
18,
206,
203,
1082,
380,
206,
203,
1082,
380,
17320,
3433,
394,
6205,
16,
471,
679,
3433,
6855,
206,
203,
1082,
380,
312,
67,
9898,
11974,
18,
6543,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
206,
203,
202,
380,
2974,
13235,
333,
791,
358,
11247,
358,
279,
394,
14754,
2548,
206,
203,
202,
380,
632,
891,
293,
67,
712,
1021,
1509,
434,
326,
394,
2548,
206,
203,
202,
380,
632,
15069,
18361,
1220,
1520,
380,
49,
5996,
14,
506,
6718,
635,
333,
707,
206,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
3f7930d903a6180fecbeec44c710246604805483 | zhangchenbocalvin/stackelberg-pricing-games | src/SimpleLeader.java | [
"MIT"
] | Java | proceedNewDay | null | @Override
public void proceedNewDay(int p_date)
throws RemoteException
{
m_platformStub.publishPrice(m_type, genPrice(1.8f, 0.05f));
} | /**
* To inform this instance to proceed to a new simulation day
* @param p_date The date of the new day
* @throws RemoteException
*/ | To inform this instance to proceed to a new simulation day
@param p_date The date of the new day
@throws RemoteException | [
"To",
"inform",
"this",
"instance",
"to",
"proceed",
"to",
"a",
"new",
"simulation",
"day",
"@param",
"p_date",
"The",
"date",
"of",
"the",
"new",
"day",
"@throws",
"RemoteException"
] | @Override
public void proceedNewDay(int p_date)
throws RemoteException
{
m_platformStub.publishPrice(m_type, genPrice(1.8f, 0.05f));
} | [
"@",
"Override",
"public",
"void",
"proceedNewDay",
"(",
"int",
"p_date",
")",
"throws",
"RemoteException",
"{",
"m_platformStub",
".",
"publishPrice",
"(",
"m_type",
",",
"genPrice",
"(",
"1.8f",
",",
"0.05f",
")",
")",
";",
"}"
] | To inform this instance to proceed to a new simulation day
@param p_date The date of the new day
@throws RemoteException | [
"To",
"inform",
"this",
"instance",
"to",
"proceed",
"to",
"a",
"new",
"simulation",
"day",
"@param",
"p_date",
"The",
"date",
"of",
"the",
"new",
"day",
"@throws",
"RemoteException"
] | [] | [
{
"param": "p_date",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p_date",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
202,
482,
918,
11247,
1908,
4245,
12,
474,
293,
67,
712,
13,
203,
202,
202,
15069,
18361,
203,
202,
95,
203,
202,
202,
81,
67,
9898,
11974,
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,
2548,
203,
202,
380,
632,
15069,
18361,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
fa3b5609fabd43fc018550c357b0b0cdaff04071 | chinna246/ontology | OWLTools-Core/src/main/java/owltools/graph/OWLGraphWrapperExtended.java | [
"BSD-3-Clause"
] | Java | isObsolete | null | public boolean isObsolete(OWLObject c) {
for (OWLOntology ont : getAllOntologies()) {
for (OWLAnnotation ann : OwlHelper.getAnnotations((OWLEntity) c, ont)) {
if (ann.isDeprecatedIRIAnnotation()) {
return true;
}
}
}
return false;
} | /**
* tests if an OWLObject has been declared obsolete in the graph.
*
* @param c
* @return boolean
*/ | tests if an OWLObject has been declared obsolete in the graph.
@param c
@return boolean | [
"tests",
"if",
"an",
"OWLObject",
"has",
"been",
"declared",
"obsolete",
"in",
"the",
"graph",
".",
"@param",
"c",
"@return",
"boolean"
] | public boolean isObsolete(OWLObject c) {
for (OWLOntology ont : getAllOntologies()) {
for (OWLAnnotation ann : OwlHelper.getAnnotations((OWLEntity) c, ont)) {
if (ann.isDeprecatedIRIAnnotation()) {
return true;
}
}
}
return false;
} | [
"public",
"boolean",
"isObsolete",
"(",
"OWLObject",
"c",
")",
"{",
"for",
"(",
"OWLOntology",
"ont",
":",
"getAllOntologies",
"(",
")",
")",
"{",
"for",
"(",
"OWLAnnotation",
"ann",
":",
"OwlHelper",
".",
"getAnnotations",
"(",
"(",
"OWLEntity",
")",
"c",
",",
"ont",
")",
")",
"{",
"if",
"(",
"ann",
".",
"isDeprecatedIRIAnnotation",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] | tests if an OWLObject has been declared obsolete in the graph. | [
"tests",
"if",
"an",
"OWLObject",
"has",
"been",
"declared",
"obsolete",
"in",
"the",
"graph",
"."
] | [] | [
{
"param": "c",
"type": "OWLObject"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": "OWLObject",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
1250,
353,
27637,
19513,
12,
7306,
48,
921,
276,
13,
288,
203,
202,
202,
1884,
261,
7306,
1502,
19610,
603,
88,
294,
5514,
51,
496,
27854,
10756,
288,
203,
1082,
202,
1884,
261,
7306,
48,
3257,
8226,
294,
14223,
80,
2276,
18,
588,
5655,
12443,
7306,
900,
1628,
13,
276,
16,
603,
88,
3719,
288,
203,
9506,
202,
430,
261,
1072,
18,
291,
13534,
45,
2259,
3257,
10756,
288,
203,
6862,
202,
2463,
638,
31,
203,
9506,
202,
97,
203,
1082,
202,
97,
203,
202,
202,
97,
203,
202,
202,
2463,
629,
31,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
7434,
309,
392,
25266,
921,
711,
2118,
7886,
27191,
316,
326,
2667,
18,
203,
202,
380,
7010,
202,
380,
632,
891,
276,
203,
202,
380,
632,
2463,
1250,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
6da8d4e841f56336eb88498dd7afbe2379710303 | chinna246/ontology | OWLTools-Core/src/test/java/owltools/graph/OWLGraphWrapperEdgeTest.java | [
"BSD-3-Clause"
] | Java | testOWLGraphEdgeAxioms | null | @Test
public void testOWLGraphEdgeAxioms() throws OWLOntologyCreationException, OBOFormatParserException, IOException {
OWLGraphWrapper g = getGraph("graph/owlgraphedge.obo");
OWLOntology o = g.getSourceOntology();
OWLOntologyManager m = o.getOWLOntologyManager();
OWLDataFactory f = m.getOWLDataFactory();
OWLClass root = g.getOWLClassByIdentifier("FOO:0001");
OWLClass cls1 = g.getOWLClassByIdentifier("FOO:0003");
Set<OWLGraphEdge> edges = g.getOutgoingEdges(cls1);
Set<OWLGraphEdge> expectedEdges = new HashSet<OWLGraphEdge>();
expectedEdges.add(new OWLGraphEdge(cls1, root, g.getSourceOntology()));
assertEquals("Incorrect OWLGraphEdges generated for Foo:0003", expectedEdges, edges);
OWLGraphEdge edge = edges.iterator().next();
Set<OWLAxiom> expectedAxioms = new HashSet<OWLAxiom>();
expectedAxioms.add(f.getOWLSubClassOfAxiom(cls1, root));
expectedAxioms.add(f.getOWLEquivalentClassesAxiom(cls1, root));
assertEquals("Incorrect underlying OWLAxioms", expectedAxioms, edge.getAxioms());
OWLClass cls2 = g.getOWLClassByIdentifier("FOO:0004");
OWLClass cls3 = g.getOWLClassByIdentifier("FOO:0002");
edges = g.getOutgoingEdges(cls2);
expectedEdges = new HashSet<OWLGraphEdge>();
OWLGraphEdge edge1 = new OWLGraphEdge(cls2, cls3, g.getSourceOntology());
OWLObjectSomeValuesFrom clsExp = f.getOWLObjectSomeValuesFrom(
g.getOWLObjectPropertyByIdentifier("BFO:0000050"), cls1);
OWLGraphEdge edge2 = new OWLGraphEdge(cls2, cls1, clsExp.getProperty(),
OWLQuantifiedProperty.Quantifier.SOME, g.getSourceOntology());
expectedEdges.add(edge1);
expectedEdges.add(edge2);
assertEquals("Incorrect OWLGraphEdges generated for Foo:0004", expectedEdges,
edges);
OWLAxiom equivAx = f.getOWLEquivalentClassesAxiom(cls2,
f.getOWLObjectIntersectionOf(cls3, clsExp));
for (OWLGraphEdge edgeToTest: edges) {
expectedAxioms = new HashSet<OWLAxiom>();
if (edgeToTest.equals(edge1)) {
expectedAxioms.add(f.getOWLSubClassOfAxiom(cls2, cls3));
expectedAxioms.add(equivAx);
} else if (edgeToTest.equals(edge2)) {
expectedAxioms.add(f.getOWLSubClassOfAxiom(cls2, clsExp));
expectedAxioms.add(equivAx);
}
assertEquals("Incorrect underlying OWLAxioms", expectedAxioms, edgeToTest.getAxioms());
}
edges = g.getOutgoingEdges(cls3);
expectedEdges = new HashSet<OWLGraphEdge>();
expectedEdges.add(new OWLGraphEdge(cls3, root, g.getSourceOntology()));
assertEquals("Incorrect OWLGraphEdges generated for Foo:0002", expectedEdges, edges);
edge = edges.iterator().next();
expectedAxioms = new HashSet<OWLAxiom>();
expectedAxioms.add(f.getOWLSubClassOfAxiom(cls3, root));
Set<OWLAnnotation> annots = new HashSet<OWLAnnotation>();
annots.add(f.getOWLAnnotation(
f.getOWLAnnotationProperty(IRI.create("http://www.geneontology.org/formats/oboInOwl#source")),
f.getOWLLiteral("mysource")));
expectedAxioms.add(f.getOWLSubClassOfAxiom(cls3, root, annots));
assertEquals("Incorrect underlying OWLAxioms", expectedAxioms, edge.getAxioms());
OWLClass cls4 = g.getOWLClassByIdentifier("FOO:0005");
OWLClass cls5 = g.getOWLClassByIdentifier("FOO:0006");
edges = g.getOutgoingEdges(cls5);
expectedEdges = new HashSet<OWLGraphEdge>();
expectedEdges.add(new OWLGraphEdge(cls5, root, g.getSourceOntology()));
assertEquals("Incorrect OWLGraphEdges generated for Foo:0006", expectedEdges, edges);
edge = edges.iterator().next();
expectedAxioms = new HashSet<OWLAxiom>();
expectedAxioms.add(f.getOWLSubClassOfAxiom(cls5, root));
equivAx = f.getOWLEquivalentClassesAxiom(root,
f.getOWLObjectUnionOf(cls4, cls5));
expectedAxioms.add(equivAx);
assertEquals("Incorrect underlying OWLAxioms", expectedAxioms, edge.getAxioms());
edges = g.getOutgoingEdges(cls4);
expectedEdges = new HashSet<OWLGraphEdge>();
expectedEdges.add(new OWLGraphEdge(cls4, root, g.getSourceOntology()));
assertEquals("Incorrect OWLGraphEdges generated for Foo:0005", expectedEdges, edges);
edge = edges.iterator().next();
expectedAxioms = new HashSet<OWLAxiom>();
expectedAxioms.add(equivAx);
assertEquals("Incorrect underlying OWLAxioms", expectedAxioms, edge.getAxioms());
// OWLIndividual ind = g.getOWLIndividualByIdentifier("john");
//
// edges = g.getOutgoingEdges(ind);
// expectedEdges = new HashSet<OWLGraphEdge>();
// expectedEdges.add(new OWLGraphEdge(ind, f.getOWLClassAssertionAxiom(root, ind),
// null, Quantifier.INSTANCE_OF, g.getSourceOntology()));
// assertEquals("Incorrect OWLGraphEdges generated for John", expectedEdges, edges);
//
// edge = edges.iterator().next();
// expectedAxioms = new HashSet<OWLAxiom>();
// expectedAxioms.add(f.getOWLClassAssertionAxiom(root, ind));
//
// assertEquals("Incorrect underlying OWLAxioms", expectedAxioms, edge.getAxioms());
} | /**
* Test the behavior of {@code OWLGraphEdge}s to store their underlying
* {@code OWLAxiom}s (different {@code OWLAxiom}s can produce a same
* {@code OWLGraphEdge}, which will store these {@code OWLAxiom}s).
*/ | Test the behavior of OWLGraphEdges to store their underlying
OWLAxioms (different OWLAxioms can produce a same
OWLGraphEdge, which will store these OWLAxioms). | [
"Test",
"the",
"behavior",
"of",
"OWLGraphEdges",
"to",
"store",
"their",
"underlying",
"OWLAxioms",
"(",
"different",
"OWLAxioms",
"can",
"produce",
"a",
"same",
"OWLGraphEdge",
"which",
"will",
"store",
"these",
"OWLAxioms",
")",
"."
] | @Test
public void testOWLGraphEdgeAxioms() throws OWLOntologyCreationException, OBOFormatParserException, IOException {
OWLGraphWrapper g = getGraph("graph/owlgraphedge.obo");
OWLOntology o = g.getSourceOntology();
OWLOntologyManager m = o.getOWLOntologyManager();
OWLDataFactory f = m.getOWLDataFactory();
OWLClass root = g.getOWLClassByIdentifier("FOO:0001");
OWLClass cls1 = g.getOWLClassByIdentifier("FOO:0003");
Set<OWLGraphEdge> edges = g.getOutgoingEdges(cls1);
Set<OWLGraphEdge> expectedEdges = new HashSet<OWLGraphEdge>();
expectedEdges.add(new OWLGraphEdge(cls1, root, g.getSourceOntology()));
assertEquals("Incorrect OWLGraphEdges generated for Foo:0003", expectedEdges, edges);
OWLGraphEdge edge = edges.iterator().next();
Set<OWLAxiom> expectedAxioms = new HashSet<OWLAxiom>();
expectedAxioms.add(f.getOWLSubClassOfAxiom(cls1, root));
expectedAxioms.add(f.getOWLEquivalentClassesAxiom(cls1, root));
assertEquals("Incorrect underlying OWLAxioms", expectedAxioms, edge.getAxioms());
OWLClass cls2 = g.getOWLClassByIdentifier("FOO:0004");
OWLClass cls3 = g.getOWLClassByIdentifier("FOO:0002");
edges = g.getOutgoingEdges(cls2);
expectedEdges = new HashSet<OWLGraphEdge>();
OWLGraphEdge edge1 = new OWLGraphEdge(cls2, cls3, g.getSourceOntology());
OWLObjectSomeValuesFrom clsExp = f.getOWLObjectSomeValuesFrom(
g.getOWLObjectPropertyByIdentifier("BFO:0000050"), cls1);
OWLGraphEdge edge2 = new OWLGraphEdge(cls2, cls1, clsExp.getProperty(),
OWLQuantifiedProperty.Quantifier.SOME, g.getSourceOntology());
expectedEdges.add(edge1);
expectedEdges.add(edge2);
assertEquals("Incorrect OWLGraphEdges generated for Foo:0004", expectedEdges,
edges);
OWLAxiom equivAx = f.getOWLEquivalentClassesAxiom(cls2,
f.getOWLObjectIntersectionOf(cls3, clsExp));
for (OWLGraphEdge edgeToTest: edges) {
expectedAxioms = new HashSet<OWLAxiom>();
if (edgeToTest.equals(edge1)) {
expectedAxioms.add(f.getOWLSubClassOfAxiom(cls2, cls3));
expectedAxioms.add(equivAx);
} else if (edgeToTest.equals(edge2)) {
expectedAxioms.add(f.getOWLSubClassOfAxiom(cls2, clsExp));
expectedAxioms.add(equivAx);
}
assertEquals("Incorrect underlying OWLAxioms", expectedAxioms, edgeToTest.getAxioms());
}
edges = g.getOutgoingEdges(cls3);
expectedEdges = new HashSet<OWLGraphEdge>();
expectedEdges.add(new OWLGraphEdge(cls3, root, g.getSourceOntology()));
assertEquals("Incorrect OWLGraphEdges generated for Foo:0002", expectedEdges, edges);
edge = edges.iterator().next();
expectedAxioms = new HashSet<OWLAxiom>();
expectedAxioms.add(f.getOWLSubClassOfAxiom(cls3, root));
Set<OWLAnnotation> annots = new HashSet<OWLAnnotation>();
annots.add(f.getOWLAnnotation(
f.getOWLAnnotationProperty(IRI.create("http://www.geneontology.org/formats/oboInOwl#source")),
f.getOWLLiteral("mysource")));
expectedAxioms.add(f.getOWLSubClassOfAxiom(cls3, root, annots));
assertEquals("Incorrect underlying OWLAxioms", expectedAxioms, edge.getAxioms());
OWLClass cls4 = g.getOWLClassByIdentifier("FOO:0005");
OWLClass cls5 = g.getOWLClassByIdentifier("FOO:0006");
edges = g.getOutgoingEdges(cls5);
expectedEdges = new HashSet<OWLGraphEdge>();
expectedEdges.add(new OWLGraphEdge(cls5, root, g.getSourceOntology()));
assertEquals("Incorrect OWLGraphEdges generated for Foo:0006", expectedEdges, edges);
edge = edges.iterator().next();
expectedAxioms = new HashSet<OWLAxiom>();
expectedAxioms.add(f.getOWLSubClassOfAxiom(cls5, root));
equivAx = f.getOWLEquivalentClassesAxiom(root,
f.getOWLObjectUnionOf(cls4, cls5));
expectedAxioms.add(equivAx);
assertEquals("Incorrect underlying OWLAxioms", expectedAxioms, edge.getAxioms());
edges = g.getOutgoingEdges(cls4);
expectedEdges = new HashSet<OWLGraphEdge>();
expectedEdges.add(new OWLGraphEdge(cls4, root, g.getSourceOntology()));
assertEquals("Incorrect OWLGraphEdges generated for Foo:0005", expectedEdges, edges);
edge = edges.iterator().next();
expectedAxioms = new HashSet<OWLAxiom>();
expectedAxioms.add(equivAx);
assertEquals("Incorrect underlying OWLAxioms", expectedAxioms, edge.getAxioms());
edges = g.getOutgoingEdges(ind);
expectedEdges = new HashSet<OWLGraphEdge>();
expectedEdges.add(new OWLGraphEdge(ind, f.getOWLClassAssertionAxiom(root, ind),
null, Quantifier.INSTANCE_OF, g.getSourceOntology()));
assertEquals("Incorrect OWLGraphEdges generated for John", expectedEdges, edges);
edge = edges.iterator().next();
expectedAxioms = new HashSet<OWLAxiom>();
expectedAxioms.add(f.getOWLClassAssertionAxiom(root, ind));
assertEquals("Incorrect underlying OWLAxioms", expectedAxioms, edge.getAxioms());
} | [
"@",
"Test",
"public",
"void",
"testOWLGraphEdgeAxioms",
"(",
")",
"throws",
"OWLOntologyCreationException",
",",
"OBOFormatParserException",
",",
"IOException",
"{",
"OWLGraphWrapper",
"g",
"=",
"getGraph",
"(",
"\"graph/owlgraphedge.obo\"",
")",
";",
"OWLOntology",
"o",
"=",
"g",
".",
"getSourceOntology",
"(",
")",
";",
"OWLOntologyManager",
"m",
"=",
"o",
".",
"getOWLOntologyManager",
"(",
")",
";",
"OWLDataFactory",
"f",
"=",
"m",
".",
"getOWLDataFactory",
"(",
")",
";",
"OWLClass",
"root",
"=",
"g",
".",
"getOWLClassByIdentifier",
"(",
"\"FOO:0001\"",
")",
";",
"OWLClass",
"cls1",
"=",
"g",
".",
"getOWLClassByIdentifier",
"(",
"\"FOO:0003\"",
")",
";",
"Set",
"<",
"OWLGraphEdge",
">",
"edges",
"=",
"g",
".",
"getOutgoingEdges",
"(",
"cls1",
")",
";",
"Set",
"<",
"OWLGraphEdge",
">",
"expectedEdges",
"=",
"new",
"HashSet",
"<",
"OWLGraphEdge",
">",
"(",
")",
";",
"expectedEdges",
".",
"add",
"(",
"new",
"OWLGraphEdge",
"(",
"cls1",
",",
"root",
",",
"g",
".",
"getSourceOntology",
"(",
")",
")",
")",
";",
"assertEquals",
"(",
"\"Incorrect OWLGraphEdges generated for Foo:0003\"",
",",
"expectedEdges",
",",
"edges",
")",
";",
"OWLGraphEdge",
"edge",
"=",
"edges",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"Set",
"<",
"OWLAxiom",
">",
"expectedAxioms",
"=",
"new",
"HashSet",
"<",
"OWLAxiom",
">",
"(",
")",
";",
"expectedAxioms",
".",
"add",
"(",
"f",
".",
"getOWLSubClassOfAxiom",
"(",
"cls1",
",",
"root",
")",
")",
";",
"expectedAxioms",
".",
"add",
"(",
"f",
".",
"getOWLEquivalentClassesAxiom",
"(",
"cls1",
",",
"root",
")",
")",
";",
"assertEquals",
"(",
"\"Incorrect underlying OWLAxioms\"",
",",
"expectedAxioms",
",",
"edge",
".",
"getAxioms",
"(",
")",
")",
";",
"OWLClass",
"cls2",
"=",
"g",
".",
"getOWLClassByIdentifier",
"(",
"\"FOO:0004\"",
")",
";",
"OWLClass",
"cls3",
"=",
"g",
".",
"getOWLClassByIdentifier",
"(",
"\"FOO:0002\"",
")",
";",
"edges",
"=",
"g",
".",
"getOutgoingEdges",
"(",
"cls2",
")",
";",
"expectedEdges",
"=",
"new",
"HashSet",
"<",
"OWLGraphEdge",
">",
"(",
")",
";",
"OWLGraphEdge",
"edge1",
"=",
"new",
"OWLGraphEdge",
"(",
"cls2",
",",
"cls3",
",",
"g",
".",
"getSourceOntology",
"(",
")",
")",
";",
"OWLObjectSomeValuesFrom",
"clsExp",
"=",
"f",
".",
"getOWLObjectSomeValuesFrom",
"(",
"g",
".",
"getOWLObjectPropertyByIdentifier",
"(",
"\"BFO:0000050\"",
")",
",",
"cls1",
")",
";",
"OWLGraphEdge",
"edge2",
"=",
"new",
"OWLGraphEdge",
"(",
"cls2",
",",
"cls1",
",",
"clsExp",
".",
"getProperty",
"(",
")",
",",
"OWLQuantifiedProperty",
".",
"Quantifier",
".",
"SOME",
",",
"g",
".",
"getSourceOntology",
"(",
")",
")",
";",
"expectedEdges",
".",
"add",
"(",
"edge1",
")",
";",
"expectedEdges",
".",
"add",
"(",
"edge2",
")",
";",
"assertEquals",
"(",
"\"Incorrect OWLGraphEdges generated for Foo:0004\"",
",",
"expectedEdges",
",",
"edges",
")",
";",
"OWLAxiom",
"equivAx",
"=",
"f",
".",
"getOWLEquivalentClassesAxiom",
"(",
"cls2",
",",
"f",
".",
"getOWLObjectIntersectionOf",
"(",
"cls3",
",",
"clsExp",
")",
")",
";",
"for",
"(",
"OWLGraphEdge",
"edgeToTest",
":",
"edges",
")",
"{",
"expectedAxioms",
"=",
"new",
"HashSet",
"<",
"OWLAxiom",
">",
"(",
")",
";",
"if",
"(",
"edgeToTest",
".",
"equals",
"(",
"edge1",
")",
")",
"{",
"expectedAxioms",
".",
"add",
"(",
"f",
".",
"getOWLSubClassOfAxiom",
"(",
"cls2",
",",
"cls3",
")",
")",
";",
"expectedAxioms",
".",
"add",
"(",
"equivAx",
")",
";",
"}",
"else",
"if",
"(",
"edgeToTest",
".",
"equals",
"(",
"edge2",
")",
")",
"{",
"expectedAxioms",
".",
"add",
"(",
"f",
".",
"getOWLSubClassOfAxiom",
"(",
"cls2",
",",
"clsExp",
")",
")",
";",
"expectedAxioms",
".",
"add",
"(",
"equivAx",
")",
";",
"}",
"assertEquals",
"(",
"\"Incorrect underlying OWLAxioms\"",
",",
"expectedAxioms",
",",
"edgeToTest",
".",
"getAxioms",
"(",
")",
")",
";",
"}",
"edges",
"=",
"g",
".",
"getOutgoingEdges",
"(",
"cls3",
")",
";",
"expectedEdges",
"=",
"new",
"HashSet",
"<",
"OWLGraphEdge",
">",
"(",
")",
";",
"expectedEdges",
".",
"add",
"(",
"new",
"OWLGraphEdge",
"(",
"cls3",
",",
"root",
",",
"g",
".",
"getSourceOntology",
"(",
")",
")",
")",
";",
"assertEquals",
"(",
"\"Incorrect OWLGraphEdges generated for Foo:0002\"",
",",
"expectedEdges",
",",
"edges",
")",
";",
"edge",
"=",
"edges",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"expectedAxioms",
"=",
"new",
"HashSet",
"<",
"OWLAxiom",
">",
"(",
")",
";",
"expectedAxioms",
".",
"add",
"(",
"f",
".",
"getOWLSubClassOfAxiom",
"(",
"cls3",
",",
"root",
")",
")",
";",
"Set",
"<",
"OWLAnnotation",
">",
"annots",
"=",
"new",
"HashSet",
"<",
"OWLAnnotation",
">",
"(",
")",
";",
"annots",
".",
"add",
"(",
"f",
".",
"getOWLAnnotation",
"(",
"f",
".",
"getOWLAnnotationProperty",
"(",
"IRI",
".",
"create",
"(",
"\"http://www.geneontology.org/formats/oboInOwl#source\"",
")",
")",
",",
"f",
".",
"getOWLLiteral",
"(",
"\"mysource\"",
")",
")",
")",
";",
"expectedAxioms",
".",
"add",
"(",
"f",
".",
"getOWLSubClassOfAxiom",
"(",
"cls3",
",",
"root",
",",
"annots",
")",
")",
";",
"assertEquals",
"(",
"\"Incorrect underlying OWLAxioms\"",
",",
"expectedAxioms",
",",
"edge",
".",
"getAxioms",
"(",
")",
")",
";",
"OWLClass",
"cls4",
"=",
"g",
".",
"getOWLClassByIdentifier",
"(",
"\"FOO:0005\"",
")",
";",
"OWLClass",
"cls5",
"=",
"g",
".",
"getOWLClassByIdentifier",
"(",
"\"FOO:0006\"",
")",
";",
"edges",
"=",
"g",
".",
"getOutgoingEdges",
"(",
"cls5",
")",
";",
"expectedEdges",
"=",
"new",
"HashSet",
"<",
"OWLGraphEdge",
">",
"(",
")",
";",
"expectedEdges",
".",
"add",
"(",
"new",
"OWLGraphEdge",
"(",
"cls5",
",",
"root",
",",
"g",
".",
"getSourceOntology",
"(",
")",
")",
")",
";",
"assertEquals",
"(",
"\"Incorrect OWLGraphEdges generated for Foo:0006\"",
",",
"expectedEdges",
",",
"edges",
")",
";",
"edge",
"=",
"edges",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"expectedAxioms",
"=",
"new",
"HashSet",
"<",
"OWLAxiom",
">",
"(",
")",
";",
"expectedAxioms",
".",
"add",
"(",
"f",
".",
"getOWLSubClassOfAxiom",
"(",
"cls5",
",",
"root",
")",
")",
";",
"equivAx",
"=",
"f",
".",
"getOWLEquivalentClassesAxiom",
"(",
"root",
",",
"f",
".",
"getOWLObjectUnionOf",
"(",
"cls4",
",",
"cls5",
")",
")",
";",
"expectedAxioms",
".",
"add",
"(",
"equivAx",
")",
";",
"assertEquals",
"(",
"\"Incorrect underlying OWLAxioms\"",
",",
"expectedAxioms",
",",
"edge",
".",
"getAxioms",
"(",
")",
")",
";",
"edges",
"=",
"g",
".",
"getOutgoingEdges",
"(",
"cls4",
")",
";",
"expectedEdges",
"=",
"new",
"HashSet",
"<",
"OWLGraphEdge",
">",
"(",
")",
";",
"expectedEdges",
".",
"add",
"(",
"new",
"OWLGraphEdge",
"(",
"cls4",
",",
"root",
",",
"g",
".",
"getSourceOntology",
"(",
")",
")",
")",
";",
"assertEquals",
"(",
"\"Incorrect OWLGraphEdges generated for Foo:0005\"",
",",
"expectedEdges",
",",
"edges",
")",
";",
"edge",
"=",
"edges",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"expectedAxioms",
"=",
"new",
"HashSet",
"<",
"OWLAxiom",
">",
"(",
")",
";",
"expectedAxioms",
".",
"add",
"(",
"equivAx",
")",
";",
"assertEquals",
"(",
"\"Incorrect underlying OWLAxioms\"",
",",
"expectedAxioms",
",",
"edge",
".",
"getAxioms",
"(",
")",
")",
";",
"}"
] | Test the behavior of {@code OWLGraphEdge}s to store their underlying
{@code OWLAxiom}s (different {@code OWLAxiom}s can produce a same
{@code OWLGraphEdge}, which will store these {@code OWLAxiom}s). | [
"Test",
"the",
"behavior",
"of",
"{",
"@code",
"OWLGraphEdge",
"}",
"s",
"to",
"store",
"their",
"underlying",
"{",
"@code",
"OWLAxiom",
"}",
"s",
"(",
"different",
"{",
"@code",
"OWLAxiom",
"}",
"s",
"can",
"produce",
"a",
"same",
"{",
"@code",
"OWLGraphEdge",
"}",
"which",
"will",
"store",
"these",
"{",
"@code",
"OWLAxiom",
"}",
"s",
")",
"."
] | [
"// OWLIndividual ind = g.getOWLIndividualByIdentifier(\"john\");",
"// ",
"// edges = g.getOutgoingEdges(ind);",
"// expectedEdges = new HashSet<OWLGraphEdge>();",
"// expectedEdges.add(new OWLGraphEdge(ind, f.getOWLClassAssertionAxiom(root, ind), ",
"// null, Quantifier.INSTANCE_OF, g.getSourceOntology()));",
"// assertEquals(\"Incorrect OWLGraphEdges generated for John\", expectedEdges, edges);",
"// ",
"// edge = edges.iterator().next();",
"// expectedAxioms = new HashSet<OWLAxiom>();",
"// expectedAxioms.add(f.getOWLClassAssertionAxiom(root, ind));",
"// ",
"// assertEquals(\"Incorrect underlying OWLAxioms\", expectedAxioms, edge.getAxioms());"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
202,
482,
918,
1842,
7306,
48,
4137,
6098,
14408,
14642,
87,
1435,
1216,
18233,
1502,
19610,
9906,
503,
16,
531,
5315,
1630,
25746,
16,
1860,
288,
203,
3639,
25266,
4137,
3611,
314,
273,
26479,
2932,
4660,
19,
543,
80,
4660,
7126,
18,
947,
83,
8863,
203,
540,
203,
3639,
18233,
1502,
19610,
320,
273,
314,
18,
588,
1830,
51,
19610,
5621,
203,
3639,
18233,
1502,
19610,
1318,
312,
273,
320,
18,
588,
7306,
1502,
19610,
1318,
5621,
203,
3639,
25266,
751,
1733,
284,
273,
312,
18,
588,
7306,
48,
751,
1733,
5621,
203,
540,
203,
540,
203,
540,
203,
3639,
25266,
797,
1365,
273,
314,
18,
588,
7306,
48,
797,
27498,
2932,
3313,
51,
30,
13304,
8863,
203,
3639,
25266,
797,
2028,
21,
273,
314,
18,
588,
7306,
48,
797,
27498,
2932,
3313,
51,
30,
30770,
8863,
203,
540,
203,
3639,
1000,
32,
7306,
48,
4137,
6098,
34,
5231,
273,
314,
18,
588,
24866,
10697,
12,
6429,
21,
1769,
203,
3639,
1000,
32,
7306,
48,
4137,
6098,
34,
2665,
10697,
273,
394,
6847,
32,
7306,
48,
4137,
6098,
34,
5621,
203,
3639,
2665,
10697,
18,
1289,
12,
2704,
25266,
4137,
6098,
12,
6429,
21,
16,
1365,
16,
314,
18,
588,
1830,
51,
19610,
1435,
10019,
203,
3639,
1815,
8867,
2932,
16268,
25266,
4137,
10697,
4374,
364,
23077,
30,
30770,
3113,
2665,
10697,
16,
5231,
1769,
203,
540,
203,
3639,
25266,
4137,
6098,
3591,
273,
5231,
18,
9838,
7675,
4285,
5621,
203,
3639,
1000,
32,
7306,
2534,
92,
14642,
34,
2665,
14408,
14642,
87,
273,
394,
6847,
32,
7306,
2534,
92,
14642,
34,
5621,
203,
3639,
2665,
14408,
14642,
87,
18,
1289,
12,
74,
18,
588,
7306,
48,
1676,
797,
951,
14408,
14642,
12,
6429,
21,
16,
1365,
10019,
203,
3639,
2665,
14408,
14642,
87,
18,
1289,
12,
74,
18,
588,
7306,
900,
372,
6505,
4818,
14408,
14642,
12,
6429,
21,
16,
1365,
10019,
203,
3639,
1815,
8867,
2932,
16268,
6808,
18233,
2534,
92,
14642,
87,
3113,
2665,
14408,
14642,
87,
16,
3591,
18,
588,
14408,
14642,
87,
10663,
203,
540,
203,
203,
540,
203,
3639,
25266,
797,
2028,
22,
273,
314,
18,
588,
7306,
48,
797,
27498,
2932,
3313,
51,
30,
31262,
8863,
203,
3639,
25266,
797,
2028,
23,
273,
314,
18,
588,
7306,
48,
797,
27498,
2932,
3313,
51,
30,
17954,
8863,
203,
540,
203,
3639,
5231,
273,
314,
18,
588,
24866,
10697,
12,
6429,
22,
1769,
203,
3639,
2665,
10697,
273,
394,
6847,
32,
7306,
48,
4137,
6098,
34,
5621,
203,
3639,
25266,
4137,
6098,
3591,
21,
273,
394,
25266,
4137,
6098,
12,
6429,
22,
16,
2028,
23,
16,
314,
18,
588,
1830,
51,
19610,
10663,
203,
3639,
25266,
921,
17358,
1972,
1265,
2028,
2966,
273,
284,
18,
588,
7306,
48,
921,
17358,
1972,
1265,
12,
203,
7734,
314,
18,
588,
7306,
48,
921,
1396,
27498,
2932,
38,
3313,
30,
11706,
3361,
6,
3631,
2028,
21,
1769,
203,
3639,
25266,
4137,
6098,
3591,
22,
273,
394,
25266,
4137,
6098,
12,
6429,
22,
16,
2028,
21,
16,
2028,
2966,
18,
588,
1396,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
202,
380,
7766,
326,
6885,
434,
8901,
710,
25266,
4137,
6098,
97,
87,
358,
1707,
3675,
6808,
7010,
202,
380,
8901,
710,
18233,
2534,
92,
14642,
97,
87,
261,
30738,
8901,
710,
18233,
2534,
92,
14642,
97,
87,
848,
11402,
279,
1967,
7010,
202,
380,
8901,
710,
25266,
4137,
6098,
5779,
1492,
903,
1707,
4259,
8901,
710,
18233,
2534,
92,
14642,
97,
87,
2934,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
a049e3b0adaf50d8122e31efc6b8a5114ba1aa7f | jakeswenson/envelop | java/app-encryption/src/it/java/com/godaddy/asherah/multithreaded/MultiPartitionMultiThreadedIT.java | [
"MIT"
] | Java | multiThreadedSameFactoryMultiplePartitionsEncryptDecrypt | null | @Test
void multiThreadedSameFactoryMultiplePartitionsEncryptDecrypt() {
ExecutorService pool = Executors.newFixedThreadPool(TEST_PARAM_NUM_THREADS);
LongAdder tasksCompleted = new LongAdder();
IntStream.range(0, TEST_PARAM_NUM_THREADS)
.parallel()
.forEach(i -> {
pool.submit(() -> {
runEncryptDecryptTest(TEST_PARAM_NUM_ITERATIONS, String.format("thread-pool-%d", i), TEST_PARAM_PAYLOAD_SIZE_BYTES);
tasksCompleted.increment();
});
});
try {
pool.shutdown();
pool.awaitTermination(TEST_PARAM_THREAD_POOL_TIMEOUT_SECONDS, TimeUnit.SECONDS);
}
catch (InterruptedException e) {
LOG.error("interrupted exception during thread pool shutdown", e);
}
assertEquals(TEST_PARAM_NUM_THREADS, tasksCompleted.intValue());
} | /**
* Create a single session to encrypt and decrypt data for multiple partitions.
* <p>
* Ensure keys get created properly, DRR's are created as expected,
* and (future) collect timing information to ensure no thread is
* starved more than others since there will be some locks in play.
*/ | Create a single session to encrypt and decrypt data for multiple partitions.
Ensure keys get created properly, DRR's are created as expected,
and (future) collect timing information to ensure no thread is
starved more than others since there will be some locks in play. | [
"Create",
"a",
"single",
"session",
"to",
"encrypt",
"and",
"decrypt",
"data",
"for",
"multiple",
"partitions",
".",
"Ensure",
"keys",
"get",
"created",
"properly",
"DRR",
"'",
"s",
"are",
"created",
"as",
"expected",
"and",
"(",
"future",
")",
"collect",
"timing",
"information",
"to",
"ensure",
"no",
"thread",
"is",
"starved",
"more",
"than",
"others",
"since",
"there",
"will",
"be",
"some",
"locks",
"in",
"play",
"."
] | @Test
void multiThreadedSameFactoryMultiplePartitionsEncryptDecrypt() {
ExecutorService pool = Executors.newFixedThreadPool(TEST_PARAM_NUM_THREADS);
LongAdder tasksCompleted = new LongAdder();
IntStream.range(0, TEST_PARAM_NUM_THREADS)
.parallel()
.forEach(i -> {
pool.submit(() -> {
runEncryptDecryptTest(TEST_PARAM_NUM_ITERATIONS, String.format("thread-pool-%d", i), TEST_PARAM_PAYLOAD_SIZE_BYTES);
tasksCompleted.increment();
});
});
try {
pool.shutdown();
pool.awaitTermination(TEST_PARAM_THREAD_POOL_TIMEOUT_SECONDS, TimeUnit.SECONDS);
}
catch (InterruptedException e) {
LOG.error("interrupted exception during thread pool shutdown", e);
}
assertEquals(TEST_PARAM_NUM_THREADS, tasksCompleted.intValue());
} | [
"@",
"Test",
"void",
"multiThreadedSameFactoryMultiplePartitionsEncryptDecrypt",
"(",
")",
"{",
"ExecutorService",
"pool",
"=",
"Executors",
".",
"newFixedThreadPool",
"(",
"TEST_PARAM_NUM_THREADS",
")",
";",
"LongAdder",
"tasksCompleted",
"=",
"new",
"LongAdder",
"(",
")",
";",
"IntStream",
".",
"range",
"(",
"0",
",",
"TEST_PARAM_NUM_THREADS",
")",
".",
"parallel",
"(",
")",
".",
"forEach",
"(",
"i",
"->",
"{",
"pool",
".",
"submit",
"(",
"(",
")",
"->",
"{",
"runEncryptDecryptTest",
"(",
"TEST_PARAM_NUM_ITERATIONS",
",",
"String",
".",
"format",
"(",
"\"thread-pool-%d\"",
",",
"i",
")",
",",
"TEST_PARAM_PAYLOAD_SIZE_BYTES",
")",
";",
"tasksCompleted",
".",
"increment",
"(",
")",
";",
"}",
")",
";",
"}",
")",
";",
"try",
"{",
"pool",
".",
"shutdown",
"(",
")",
";",
"pool",
".",
"awaitTermination",
"(",
"TEST_PARAM_THREAD_POOL_TIMEOUT_SECONDS",
",",
"TimeUnit",
".",
"SECONDS",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"interrupted exception during thread pool shutdown\"",
",",
"e",
")",
";",
"}",
"assertEquals",
"(",
"TEST_PARAM_NUM_THREADS",
",",
"tasksCompleted",
".",
"intValue",
"(",
")",
")",
";",
"}"
] | Create a single session to encrypt and decrypt data for multiple partitions. | [
"Create",
"a",
"single",
"session",
"to",
"encrypt",
"and",
"decrypt",
"data",
"for",
"multiple",
"partitions",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
225,
918,
3309,
1315,
20528,
8650,
1733,
8438,
13738,
13129,
17306,
1435,
288,
203,
565,
27299,
2845,
273,
3889,
13595,
18,
2704,
7505,
20621,
12,
16961,
67,
8388,
67,
6069,
67,
21730,
55,
1769,
203,
565,
3407,
986,
264,
4592,
9556,
273,
394,
3407,
986,
264,
5621,
203,
203,
565,
3094,
1228,
18,
3676,
12,
20,
16,
22130,
67,
8388,
67,
6069,
67,
21730,
55,
13,
203,
1377,
263,
18054,
1435,
203,
1377,
263,
1884,
3442,
12,
77,
317,
288,
203,
3639,
2845,
18,
9297,
12,
1435,
317,
288,
203,
1850,
1086,
13129,
17306,
4709,
12,
16961,
67,
8388,
67,
6069,
67,
11844,
15297,
16,
514,
18,
2139,
2932,
5930,
17,
6011,
6456,
72,
3113,
277,
3631,
22130,
67,
8388,
67,
11389,
7783,
67,
4574,
67,
13718,
1769,
203,
1850,
4592,
9556,
18,
15016,
5621,
203,
3639,
15549,
203,
1377,
15549,
203,
203,
565,
775,
288,
203,
1377,
2845,
18,
15132,
5621,
203,
1377,
2845,
18,
30515,
16516,
12,
16961,
67,
8388,
67,
21730,
67,
20339,
67,
9503,
67,
11609,
16,
9206,
18,
11609,
1769,
203,
565,
289,
203,
565,
1044,
261,
24485,
503,
425,
13,
288,
203,
1377,
2018,
18,
1636,
2932,
474,
5954,
1520,
4982,
2650,
2845,
5731,
3113,
425,
1769,
203,
565,
289,
203,
203,
565,
1815,
8867,
12,
16961,
67,
8388,
67,
6069,
67,
21730,
55,
16,
4592,
9556,
18,
474,
620,
10663,
203,
225,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
282,
380,
1788,
279,
2202,
1339,
358,
7347,
471,
8420,
501,
364,
3229,
10060,
18,
203,
282,
380,
411,
84,
34,
203,
282,
380,
7693,
1311,
336,
2522,
8214,
16,
16801,
54,
1807,
854,
2522,
487,
2665,
16,
203,
282,
380,
471,
261,
14343,
13,
3274,
15538,
1779,
358,
3387,
1158,
2650,
353,
203,
282,
380,
10443,
2155,
1898,
2353,
10654,
3241,
1915,
903,
506,
2690,
13046,
316,
6599,
18,
203,
282,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
a049e3b0adaf50d8122e31efc6b8a5114ba1aa7f | jakeswenson/envelop | java/app-encryption/src/it/java/com/godaddy/asherah/multithreaded/MultiPartitionMultiThreadedIT.java | [
"MIT"
] | Java | multiThreadedSameFactoryMultiplePartitionsLoadStore | null | @Test
void multiThreadedSameFactoryMultiplePartitionsLoadStore() {
ExecutorService pool = Executors.newFixedThreadPool(TEST_PARAM_NUM_THREADS);
LongAdder tasksCompleted = new LongAdder();
IntStream.range(0, TEST_PARAM_NUM_THREADS)
.parallel()
.forEach(i -> {
pool.submit(() -> {
runLoadStoreTest(TEST_PARAM_NUM_ITERATIONS, String.format("thread-pool-%d", i), TEST_PARAM_PAYLOAD_SIZE_BYTES);
tasksCompleted.increment();
});
});
try {
pool.shutdown();
pool.awaitTermination(TEST_PARAM_THREAD_POOL_TIMEOUT_SECONDS, TimeUnit.SECONDS);
}
catch (InterruptedException e) {
LOG.error("interrupted exception during thread pool shutdown", e);
}
assertEquals(TEST_PARAM_NUM_THREADS, tasksCompleted.intValue());
} | /**
* Create a single session to store and load data for multiple partitions.
* <p>
* Ensure keys get created properly, DRR's are created as expected,
* and (future) collect timing information to ensure no thread is
* starved more than others since there will be some locks in play.
*/ | Create a single session to store and load data for multiple partitions.
Ensure keys get created properly, DRR's are created as expected,
and (future) collect timing information to ensure no thread is
starved more than others since there will be some locks in play. | [
"Create",
"a",
"single",
"session",
"to",
"store",
"and",
"load",
"data",
"for",
"multiple",
"partitions",
".",
"Ensure",
"keys",
"get",
"created",
"properly",
"DRR",
"'",
"s",
"are",
"created",
"as",
"expected",
"and",
"(",
"future",
")",
"collect",
"timing",
"information",
"to",
"ensure",
"no",
"thread",
"is",
"starved",
"more",
"than",
"others",
"since",
"there",
"will",
"be",
"some",
"locks",
"in",
"play",
"."
] | @Test
void multiThreadedSameFactoryMultiplePartitionsLoadStore() {
ExecutorService pool = Executors.newFixedThreadPool(TEST_PARAM_NUM_THREADS);
LongAdder tasksCompleted = new LongAdder();
IntStream.range(0, TEST_PARAM_NUM_THREADS)
.parallel()
.forEach(i -> {
pool.submit(() -> {
runLoadStoreTest(TEST_PARAM_NUM_ITERATIONS, String.format("thread-pool-%d", i), TEST_PARAM_PAYLOAD_SIZE_BYTES);
tasksCompleted.increment();
});
});
try {
pool.shutdown();
pool.awaitTermination(TEST_PARAM_THREAD_POOL_TIMEOUT_SECONDS, TimeUnit.SECONDS);
}
catch (InterruptedException e) {
LOG.error("interrupted exception during thread pool shutdown", e);
}
assertEquals(TEST_PARAM_NUM_THREADS, tasksCompleted.intValue());
} | [
"@",
"Test",
"void",
"multiThreadedSameFactoryMultiplePartitionsLoadStore",
"(",
")",
"{",
"ExecutorService",
"pool",
"=",
"Executors",
".",
"newFixedThreadPool",
"(",
"TEST_PARAM_NUM_THREADS",
")",
";",
"LongAdder",
"tasksCompleted",
"=",
"new",
"LongAdder",
"(",
")",
";",
"IntStream",
".",
"range",
"(",
"0",
",",
"TEST_PARAM_NUM_THREADS",
")",
".",
"parallel",
"(",
")",
".",
"forEach",
"(",
"i",
"->",
"{",
"pool",
".",
"submit",
"(",
"(",
")",
"->",
"{",
"runLoadStoreTest",
"(",
"TEST_PARAM_NUM_ITERATIONS",
",",
"String",
".",
"format",
"(",
"\"thread-pool-%d\"",
",",
"i",
")",
",",
"TEST_PARAM_PAYLOAD_SIZE_BYTES",
")",
";",
"tasksCompleted",
".",
"increment",
"(",
")",
";",
"}",
")",
";",
"}",
")",
";",
"try",
"{",
"pool",
".",
"shutdown",
"(",
")",
";",
"pool",
".",
"awaitTermination",
"(",
"TEST_PARAM_THREAD_POOL_TIMEOUT_SECONDS",
",",
"TimeUnit",
".",
"SECONDS",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"interrupted exception during thread pool shutdown\"",
",",
"e",
")",
";",
"}",
"assertEquals",
"(",
"TEST_PARAM_NUM_THREADS",
",",
"tasksCompleted",
".",
"intValue",
"(",
")",
")",
";",
"}"
] | Create a single session to store and load data for multiple partitions. | [
"Create",
"a",
"single",
"session",
"to",
"store",
"and",
"load",
"data",
"for",
"multiple",
"partitions",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
225,
918,
3309,
1315,
20528,
8650,
1733,
8438,
13738,
2563,
2257,
1435,
288,
203,
565,
27299,
2845,
273,
3889,
13595,
18,
2704,
7505,
20621,
12,
16961,
67,
8388,
67,
6069,
67,
21730,
55,
1769,
203,
565,
3407,
986,
264,
4592,
9556,
273,
394,
3407,
986,
264,
5621,
203,
203,
565,
3094,
1228,
18,
3676,
12,
20,
16,
22130,
67,
8388,
67,
6069,
67,
21730,
55,
13,
203,
1377,
263,
18054,
1435,
203,
1377,
263,
1884,
3442,
12,
77,
317,
288,
203,
3639,
2845,
18,
9297,
12,
1435,
317,
288,
203,
1850,
1086,
2563,
2257,
4709,
12,
16961,
67,
8388,
67,
6069,
67,
11844,
15297,
16,
514,
18,
2139,
2932,
5930,
17,
6011,
6456,
72,
3113,
277,
3631,
22130,
67,
8388,
67,
11389,
7783,
67,
4574,
67,
13718,
1769,
203,
1850,
4592,
9556,
18,
15016,
5621,
203,
3639,
15549,
203,
1377,
15549,
203,
203,
565,
775,
288,
203,
1377,
2845,
18,
15132,
5621,
203,
1377,
2845,
18,
30515,
16516,
12,
16961,
67,
8388,
67,
21730,
67,
20339,
67,
9503,
67,
11609,
16,
9206,
18,
11609,
1769,
203,
565,
289,
203,
565,
1044,
261,
24485,
503,
425,
13,
288,
203,
1377,
2018,
18,
1636,
2932,
474,
5954,
1520,
4982,
2650,
2845,
5731,
3113,
425,
1769,
203,
565,
289,
203,
565,
1815,
8867,
12,
16961,
67,
8388,
67,
6069,
67,
21730,
55,
16,
4592,
9556,
18,
474,
620,
10663,
203,
225,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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54,
1807,
854,
2522,
487,
2665,
16,
203,
282,
380,
471,
261,
14343,
13,
3274,
15538,
1779,
358,
3387,
1158,
2650,
353,
203,
282,
380,
10443,
2155,
1898,
2353,
10654,
3241,
1915,
903,
506,
2690,
13046,
316,
6599,
18,
203,
282,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
43cc2ca9236645233cd6fa510b2768a043db67ba | jakeswenson/envelop | server/java/src/main/java/com/godaddy/asherah/grpc/AppEncryptionServer.java | [
"MIT"
] | Java | stop | null | public void stop() throws InterruptedException {
if (server != null) {
server.shutdown().awaitTermination(Constants.DEFAULT_SERVER_TIMEOUT, TimeUnit.SECONDS);
}
} | // Wait for some seconds for all pre-existing streams to complete | Wait for some seconds for all pre-existing streams to complete | [
"Wait",
"for",
"some",
"seconds",
"for",
"all",
"pre",
"-",
"existing",
"streams",
"to",
"complete"
] | public void stop() throws InterruptedException {
if (server != null) {
server.shutdown().awaitTermination(Constants.DEFAULT_SERVER_TIMEOUT, TimeUnit.SECONDS);
}
} | [
"public",
"void",
"stop",
"(",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"server",
"!=",
"null",
")",
"{",
"server",
".",
"shutdown",
"(",
")",
".",
"awaitTermination",
"(",
"Constants",
".",
"DEFAULT_SERVER_TIMEOUT",
",",
"TimeUnit",
".",
"SECONDS",
")",
";",
"}",
"}"
] | Wait for some seconds for all pre-existing streams to complete | [
"Wait",
"for",
"some",
"seconds",
"for",
"all",
"pre",
"-",
"existing",
"streams",
"to",
"complete"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5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
0,
0,
0,
0
] | [
1,
759,
5838,
364,
2690,
3974,
364,
777,
675,
17,
11711,
8205,
358,
3912,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
43cc2ca9236645233cd6fa510b2768a043db67ba | jakeswenson/envelop | server/java/src/main/java/com/godaddy/asherah/grpc/AppEncryptionServer.java | [
"MIT"
] | Java | blockUntilShutdown | null | public void blockUntilShutdown() throws InterruptedException {
if (server != null) {
server.awaitTermination();
}
} | // Await termination on the main thread since the grpc library uses daemon threads. | Await termination on the main thread since the grpc library uses daemon threads. | [
"Await",
"termination",
"on",
"the",
"main",
"thread",
"since",
"the",
"grpc",
"library",
"uses",
"daemon",
"threads",
"."
] | public void blockUntilShutdown() throws InterruptedException {
if (server != null) {
server.awaitTermination();
}
} | [
"public",
"void",
"blockUntilShutdown",
"(",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"server",
"!=",
"null",
")",
"{",
"server",
".",
"awaitTermination",
"(",
")",
";",
"}",
"}"
] | Await termination on the main thread since the grpc library uses daemon threads. | [
"Await",
"termination",
"on",
"the",
"main",
"thread",
"since",
"the",
"grpc",
"library",
"uses",
"daemon",
"threads",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
1203,
9716,
10961,
1435,
1216,
7558,
288,
203,
565,
309,
261,
3567,
480,
446,
13,
288,
203,
1377,
1438,
18,
30515,
16516,
5621,
203,
565,
289,
203,
225,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
759,
432,
7048,
19650,
603,
326,
2774,
2650,
3241,
326,
9466,
5313,
4692,
8131,
7403,
18,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
fcf6a7aaf0e942272a44f06ecf08f2a43dbbbacd | jakeswenson/envelop | java/app-encryption/src/main/java/com/godaddy/asherah/appencryption/persistence/JdbcMetastoreImpl.java | [
"MIT"
] | Java | load | null | @Override
public Optional<JSONObject> load(final String keyId, final Instant created) {
return loadTimer.record(() -> {
try (Connection connection = getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(LOAD_QUERY)) {
preparedStatement.setString(1, keyId);
preparedStatement.setTimestamp(2, Timestamp.from(created));
return executeQueryAndLoadJsonObjectFromKey(preparedStatement);
}
catch (SQLException se) {
logger.error("Metastore error", se);
return Optional.empty();
}
});
} | /**
* Uses the {@link JdbcMetastoreImpl#LOAD_QUERY} to retrieve the value associated with the keyId and time it was
* created.
*
* @param keyId The keyId part of the lookup key.
* @param created The created time part of the lookup key.
* @return The value associated with the keyId and created tuple, if any.
*/ | Uses the JdbcMetastoreImpl#LOAD_QUERY to retrieve the value associated with the keyId and time it was
created.
@param keyId The keyId part of the lookup key.
@param created The created time part of the lookup key.
@return The value associated with the keyId and created tuple, if any. | [
"Uses",
"the",
"JdbcMetastoreImpl#LOAD_QUERY",
"to",
"retrieve",
"the",
"value",
"associated",
"with",
"the",
"keyId",
"and",
"time",
"it",
"was",
"created",
".",
"@param",
"keyId",
"The",
"keyId",
"part",
"of",
"the",
"lookup",
"key",
".",
"@param",
"created",
"The",
"created",
"time",
"part",
"of",
"the",
"lookup",
"key",
".",
"@return",
"The",
"value",
"associated",
"with",
"the",
"keyId",
"and",
"created",
"tuple",
"if",
"any",
"."
] | @Override
public Optional<JSONObject> load(final String keyId, final Instant created) {
return loadTimer.record(() -> {
try (Connection connection = getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(LOAD_QUERY)) {
preparedStatement.setString(1, keyId);
preparedStatement.setTimestamp(2, Timestamp.from(created));
return executeQueryAndLoadJsonObjectFromKey(preparedStatement);
}
catch (SQLException se) {
logger.error("Metastore error", se);
return Optional.empty();
}
});
} | [
"@",
"Override",
"public",
"Optional",
"<",
"JSONObject",
">",
"load",
"(",
"final",
"String",
"keyId",
",",
"final",
"Instant",
"created",
")",
"{",
"return",
"loadTimer",
".",
"record",
"(",
"(",
")",
"->",
"{",
"try",
"(",
"Connection",
"connection",
"=",
"getConnection",
"(",
")",
";",
"PreparedStatement",
"preparedStatement",
"=",
"connection",
".",
"prepareStatement",
"(",
"LOAD_QUERY",
")",
")",
"{",
"preparedStatement",
".",
"setString",
"(",
"1",
",",
"keyId",
")",
";",
"preparedStatement",
".",
"setTimestamp",
"(",
"2",
",",
"Timestamp",
".",
"from",
"(",
"created",
")",
")",
";",
"return",
"executeQueryAndLoadJsonObjectFromKey",
"(",
"preparedStatement",
")",
";",
"}",
"catch",
"(",
"SQLException",
"se",
")",
"{",
"logger",
".",
"error",
"(",
"\"Metastore error\"",
",",
"se",
")",
";",
"return",
"Optional",
".",
"empty",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Uses the {@link JdbcMetastoreImpl#LOAD_QUERY} to retrieve the value associated with the keyId and time it was
created. | [
"Uses",
"the",
"{",
"@link",
"JdbcMetastoreImpl#LOAD_QUERY",
"}",
"to",
"retrieve",
"the",
"value",
"associated",
"with",
"the",
"keyId",
"and",
"time",
"it",
"was",
"created",
"."
] | [] | [
{
"param": "keyId",
"type": "String"
},
{
"param": "created",
"type": "Instant"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "keyId",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "created",
"type": "Instant",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
225,
1071,
4055,
32,
2986,
921,
34,
1262,
12,
6385,
514,
30914,
16,
727,
11190,
2522,
13,
288,
203,
565,
327,
1262,
6777,
18,
3366,
12,
1435,
317,
288,
203,
1377,
775,
261,
1952,
1459,
273,
6742,
5621,
203,
6647,
16913,
8208,
3406,
273,
1459,
18,
9366,
3406,
12,
7783,
67,
10753,
3719,
288,
203,
203,
3639,
8208,
3406,
18,
542,
780,
12,
21,
16,
30914,
1769,
203,
3639,
8208,
3406,
18,
542,
4921,
12,
22,
16,
8159,
18,
2080,
12,
4824,
10019,
203,
203,
3639,
327,
14304,
1876,
2563,
23857,
1265,
653,
12,
9366,
72,
3406,
1769,
203,
1377,
289,
203,
1377,
1044,
261,
23116,
695,
13,
288,
203,
3639,
1194,
18,
1636,
2932,
12244,
689,
479,
555,
3113,
695,
1769,
203,
3639,
327,
4055,
18,
5531,
5621,
203,
1377,
289,
203,
565,
15549,
203,
225,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
282,
380,
14854,
326,
8901,
1232,
24209,
12244,
689,
479,
2828,
7,
7783,
67,
10753,
97,
358,
4614,
326,
460,
3627,
598,
326,
30914,
471,
813,
518,
1703,
203,
282,
380,
2522,
18,
203,
282,
380,
203,
282,
380,
632,
891,
30914,
1021,
30914,
1087,
434,
326,
3689,
498,
18,
203,
282,
380,
632,
891,
2522,
1021,
2522,
813,
1087,
434,
326,
3689,
498,
18,
203,
282,
380,
632,
2463,
1021,
460,
3627,
598,
326,
30914,
471,
2522,
3193,
16,
309,
1281,
18,
203,
282,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
fcf6a7aaf0e942272a44f06ecf08f2a43dbbbacd | jakeswenson/envelop | java/app-encryption/src/main/java/com/godaddy/asherah/appencryption/persistence/JdbcMetastoreImpl.java | [
"MIT"
] | Java | loadLatest | null | @Override
public Optional<JSONObject> loadLatest(final String keyId) {
return loadLatestTimer.record(() -> {
try (Connection connection = getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(LOAD_LATEST_QUERY)) {
preparedStatement.setString(1, keyId);
return executeQueryAndLoadJsonObjectFromKey(preparedStatement);
}
catch (SQLException se) {
logger.error("Metastore error", se);
return Optional.empty();
}
});
} | /**
* Uses the {@link JdbcMetastoreImpl#LOAD_LATEST_QUERY} to retrieve the latest value associated with the keyId.
*
* @param keyId The keyId part of the lookup key.
* @return The latest value associated with the keyId, if any.
*/ | Uses the JdbcMetastoreImpl#LOAD_LATEST_QUERY to retrieve the latest value associated with the keyId.
@param keyId The keyId part of the lookup key.
@return The latest value associated with the keyId, if any. | [
"Uses",
"the",
"JdbcMetastoreImpl#LOAD_LATEST_QUERY",
"to",
"retrieve",
"the",
"latest",
"value",
"associated",
"with",
"the",
"keyId",
".",
"@param",
"keyId",
"The",
"keyId",
"part",
"of",
"the",
"lookup",
"key",
".",
"@return",
"The",
"latest",
"value",
"associated",
"with",
"the",
"keyId",
"if",
"any",
"."
] | @Override
public Optional<JSONObject> loadLatest(final String keyId) {
return loadLatestTimer.record(() -> {
try (Connection connection = getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(LOAD_LATEST_QUERY)) {
preparedStatement.setString(1, keyId);
return executeQueryAndLoadJsonObjectFromKey(preparedStatement);
}
catch (SQLException se) {
logger.error("Metastore error", se);
return Optional.empty();
}
});
} | [
"@",
"Override",
"public",
"Optional",
"<",
"JSONObject",
">",
"loadLatest",
"(",
"final",
"String",
"keyId",
")",
"{",
"return",
"loadLatestTimer",
".",
"record",
"(",
"(",
")",
"->",
"{",
"try",
"(",
"Connection",
"connection",
"=",
"getConnection",
"(",
")",
";",
"PreparedStatement",
"preparedStatement",
"=",
"connection",
".",
"prepareStatement",
"(",
"LOAD_LATEST_QUERY",
")",
")",
"{",
"preparedStatement",
".",
"setString",
"(",
"1",
",",
"keyId",
")",
";",
"return",
"executeQueryAndLoadJsonObjectFromKey",
"(",
"preparedStatement",
")",
";",
"}",
"catch",
"(",
"SQLException",
"se",
")",
"{",
"logger",
".",
"error",
"(",
"\"Metastore error\"",
",",
"se",
")",
";",
"return",
"Optional",
".",
"empty",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Uses the {@link JdbcMetastoreImpl#LOAD_LATEST_QUERY} to retrieve the latest value associated with the keyId. | [
"Uses",
"the",
"{",
"@link",
"JdbcMetastoreImpl#LOAD_LATEST_QUERY",
"}",
"to",
"retrieve",
"the",
"latest",
"value",
"associated",
"with",
"the",
"keyId",
"."
] | [] | [
{
"param": "keyId",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "keyId",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
225,
1071,
4055,
32,
2986,
921,
34,
1262,
18650,
12,
6385,
514,
30914,
13,
288,
203,
565,
327,
1262,
18650,
6777,
18,
3366,
12,
1435,
317,
288,
203,
1377,
775,
261,
1952,
1459,
273,
6742,
5621,
203,
6647,
16913,
8208,
3406,
273,
1459,
18,
9366,
3406,
12,
7783,
67,
10512,
882,
67,
10753,
3719,
288,
203,
203,
3639,
8208,
3406,
18,
542,
780,
12,
21,
16,
30914,
1769,
203,
203,
3639,
327,
14304,
1876,
2563,
23857,
1265,
653,
12,
9366,
72,
3406,
1769,
203,
1377,
289,
203,
1377,
1044,
261,
23116,
695,
13,
288,
203,
3639,
1194,
18,
1636,
2932,
12244,
689,
479,
555,
3113,
695,
1769,
203,
3639,
327,
4055,
18,
5531,
5621,
203,
1377,
289,
203,
565,
15549,
203,
225,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
282,
380,
14854,
326,
8901,
1232,
24209,
12244,
689,
479,
2828,
7,
7783,
67,
10512,
882,
67,
10753,
97,
358,
4614,
326,
4891,
460,
3627,
598,
326,
30914,
18,
203,
282,
380,
203,
282,
380,
632,
891,
30914,
1021,
30914,
1087,
434,
326,
3689,
498,
18,
203,
282,
380,
632,
2463,
1021,
4891,
460,
3627,
598,
326,
30914,
16,
309,
1281,
18,
203,
282,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
fcf6a7aaf0e942272a44f06ecf08f2a43dbbbacd | jakeswenson/envelop | java/app-encryption/src/main/java/com/godaddy/asherah/appencryption/persistence/JdbcMetastoreImpl.java | [
"MIT"
] | Java | store | null | @Override
public boolean store(final String keyId, final Instant created, final JSONObject value) {
return storeTimer.record(() -> {
try (Connection connection = getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(STORE_QUERY)) {
int i = 1;
preparedStatement.setString(i++, keyId);
preparedStatement.setTimestamp(i++, Timestamp.from(created));
preparedStatement.setString(i++, value.toString());
return preparedStatement.executeUpdate() == 1;
}
catch (SQLIntegrityConstraintViolationException iv) {
// Duplicate key exists
logger.info("Attempted to create duplicate key: {} {}", keyId, created);
return false;
}
catch (SQLException se) {
logger.error("Metastore error during store", se);
throw new AppEncryptionException("Metastore error", se);
}
});
} | /**
* Uses the {@link JdbcMetastoreImpl#STORE_QUERY} to store the value using the specified keyId and created time.
*
* @param keyId The keyId part of the lookup key.
* @param created The created time part of the lookup key.
* @param value The value to store.
* @return {@code true} if the store succeeded, false if the store failed for a known condition
* e.g., trying to save a duplicate value should return false, not throw an exception.
*/ | Uses the JdbcMetastoreImpl#STORE_QUERY to store the value using the specified keyId and created time.
@param keyId The keyId part of the lookup key.
@param created The created time part of the lookup key.
@param value The value to store.
@return true if the store succeeded, false if the store failed for a known condition
e.g., trying to save a duplicate value should return false, not throw an exception. | [
"Uses",
"the",
"JdbcMetastoreImpl#STORE_QUERY",
"to",
"store",
"the",
"value",
"using",
"the",
"specified",
"keyId",
"and",
"created",
"time",
".",
"@param",
"keyId",
"The",
"keyId",
"part",
"of",
"the",
"lookup",
"key",
".",
"@param",
"created",
"The",
"created",
"time",
"part",
"of",
"the",
"lookup",
"key",
".",
"@param",
"value",
"The",
"value",
"to",
"store",
".",
"@return",
"true",
"if",
"the",
"store",
"succeeded",
"false",
"if",
"the",
"store",
"failed",
"for",
"a",
"known",
"condition",
"e",
".",
"g",
".",
"trying",
"to",
"save",
"a",
"duplicate",
"value",
"should",
"return",
"false",
"not",
"throw",
"an",
"exception",
"."
] | @Override
public boolean store(final String keyId, final Instant created, final JSONObject value) {
return storeTimer.record(() -> {
try (Connection connection = getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(STORE_QUERY)) {
int i = 1;
preparedStatement.setString(i++, keyId);
preparedStatement.setTimestamp(i++, Timestamp.from(created));
preparedStatement.setString(i++, value.toString());
return preparedStatement.executeUpdate() == 1;
}
catch (SQLIntegrityConstraintViolationException iv) {
logger.info("Attempted to create duplicate key: {} {}", keyId, created);
return false;
}
catch (SQLException se) {
logger.error("Metastore error during store", se);
throw new AppEncryptionException("Metastore error", se);
}
});
} | [
"@",
"Override",
"public",
"boolean",
"store",
"(",
"final",
"String",
"keyId",
",",
"final",
"Instant",
"created",
",",
"final",
"JSONObject",
"value",
")",
"{",
"return",
"storeTimer",
".",
"record",
"(",
"(",
")",
"->",
"{",
"try",
"(",
"Connection",
"connection",
"=",
"getConnection",
"(",
")",
";",
"PreparedStatement",
"preparedStatement",
"=",
"connection",
".",
"prepareStatement",
"(",
"STORE_QUERY",
")",
")",
"{",
"int",
"i",
"=",
"1",
";",
"preparedStatement",
".",
"setString",
"(",
"i",
"++",
",",
"keyId",
")",
";",
"preparedStatement",
".",
"setTimestamp",
"(",
"i",
"++",
",",
"Timestamp",
".",
"from",
"(",
"created",
")",
")",
";",
"preparedStatement",
".",
"setString",
"(",
"i",
"++",
",",
"value",
".",
"toString",
"(",
")",
")",
";",
"return",
"preparedStatement",
".",
"executeUpdate",
"(",
")",
"==",
"1",
";",
"}",
"catch",
"(",
"SQLIntegrityConstraintViolationException",
"iv",
")",
"{",
"logger",
".",
"info",
"(",
"\"Attempted to create duplicate key: {} {}\"",
",",
"keyId",
",",
"created",
")",
";",
"return",
"false",
";",
"}",
"catch",
"(",
"SQLException",
"se",
")",
"{",
"logger",
".",
"error",
"(",
"\"Metastore error during store\"",
",",
"se",
")",
";",
"throw",
"new",
"AppEncryptionException",
"(",
"\"Metastore error\"",
",",
"se",
")",
";",
"}",
"}",
")",
";",
"}"
] | Uses the {@link JdbcMetastoreImpl#STORE_QUERY} to store the value using the specified keyId and created time. | [
"Uses",
"the",
"{",
"@link",
"JdbcMetastoreImpl#STORE_QUERY",
"}",
"to",
"store",
"the",
"value",
"using",
"the",
"specified",
"keyId",
"and",
"created",
"time",
"."
] | [
"// Duplicate key exists"
] | [
{
"param": "keyId",
"type": "String"
},
{
"param": "created",
"type": "Instant"
},
{
"param": "value",
"type": "JSONObject"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "keyId",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "created",
"type": "Instant",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "JSONObject",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
225,
1071,
1250,
1707,
12,
6385,
514,
30914,
16,
727,
11190,
2522,
16,
727,
8014,
460,
13,
288,
203,
565,
327,
1707,
6777,
18,
3366,
12,
1435,
317,
288,
203,
1377,
775,
261,
1952,
1459,
273,
6742,
5621,
203,
6647,
16913,
8208,
3406,
273,
1459,
18,
9366,
3406,
12,
13651,
67,
10753,
3719,
288,
203,
3639,
509,
277,
273,
404,
31,
203,
3639,
8208,
3406,
18,
542,
780,
12,
77,
9904,
16,
30914,
1769,
203,
3639,
8208,
3406,
18,
542,
4921,
12,
77,
9904,
16,
8159,
18,
2080,
12,
4824,
10019,
203,
3639,
8208,
3406,
18,
542,
780,
12,
77,
9904,
16,
460,
18,
10492,
10663,
203,
203,
3639,
327,
8208,
3406,
18,
8837,
1891,
1435,
422,
404,
31,
203,
1377,
289,
203,
1377,
1044,
261,
3997,
30669,
5806,
27052,
4674,
13,
288,
203,
3639,
368,
19072,
498,
1704,
203,
3639,
1194,
18,
1376,
2932,
28788,
358,
752,
6751,
498,
30,
2618,
3728,
16,
30914,
16,
2522,
1769,
203,
3639,
327,
629,
31,
203,
1377,
289,
203,
1377,
1044,
261,
23116,
695,
13,
288,
203,
3639,
1194,
18,
1636,
2932,
12244,
689,
479,
555,
4982,
1707,
3113,
695,
1769,
203,
3639,
604,
394,
4677,
7894,
503,
2932,
12244,
689,
479,
555,
3113,
695,
1769,
203,
1377,
289,
203,
565,
15549,
203,
225,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
282,
380,
14854,
326,
8901,
1232,
24209,
12244,
689,
479,
2828,
7,
13651,
67,
10753,
97,
358,
1707,
326,
460,
1450,
326,
1269,
30914,
471,
2522,
813,
18,
203,
282,
380,
203,
282,
380,
632,
891,
30914,
1021,
30914,
1087,
434,
326,
3689,
498,
18,
203,
282,
380,
632,
891,
2522,
1021,
2522,
813,
1087,
434,
326,
3689,
498,
18,
203,
282,
380,
632,
891,
460,
1021,
460,
358,
1707,
18,
203,
282,
380,
632,
2463,
8901,
710,
638,
97,
309,
326,
1707,
15784,
16,
629,
309,
326,
1707,
2535,
364,
279,
4846,
2269,
203,
282,
380,
540,
425,
18,
75,
12990,
8374,
358,
1923,
279,
6751,
460,
1410,
327,
629,
16,
486,
604,
392,
1520,
18,
203,
282,
1195,
2,
-100,
-100,
-100,
-100
] |
0e1dce5872fdef3e8f52ccff47ba40277d3b1c81 | jakeswenson/envelop | server/java/target/generated-sources/protobuf/grpc-java/com/godaddy/asherah/grpc/AppEncryptionGrpc.java | [
"MIT"
] | Java | newStub | AppEncryptionStub | public static AppEncryptionStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<AppEncryptionStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<AppEncryptionStub>() {
@java.lang.Override
public AppEncryptionStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new AppEncryptionStub(channel, callOptions);
}
};
return AppEncryptionStub.newStub(factory, channel);
} | /**
* Creates a new async stub that supports all call types for the service
*/ | Creates a new async stub that supports all call types for the service | [
"Creates",
"a",
"new",
"async",
"stub",
"that",
"supports",
"all",
"call",
"types",
"for",
"the",
"service"
] | public static AppEncryptionStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<AppEncryptionStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<AppEncryptionStub>() {
@java.lang.Override
public AppEncryptionStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new AppEncryptionStub(channel, callOptions);
}
};
return AppEncryptionStub.newStub(factory, channel);
} | [
"public",
"static",
"AppEncryptionStub",
"newStub",
"(",
"io",
".",
"grpc",
".",
"Channel",
"channel",
")",
"{",
"io",
".",
"grpc",
".",
"stub",
".",
"AbstractStub",
".",
"StubFactory",
"<",
"AppEncryptionStub",
">",
"factory",
"=",
"new",
"io",
".",
"grpc",
".",
"stub",
".",
"AbstractStub",
".",
"StubFactory",
"<",
"AppEncryptionStub",
">",
"(",
")",
"{",
"@",
"java",
".",
"lang",
".",
"Override",
"public",
"AppEncryptionStub",
"newStub",
"(",
"io",
".",
"grpc",
".",
"Channel",
"channel",
",",
"io",
".",
"grpc",
".",
"CallOptions",
"callOptions",
")",
"{",
"return",
"new",
"AppEncryptionStub",
"(",
"channel",
",",
"callOptions",
")",
";",
"}",
"}",
";",
"return",
"AppEncryptionStub",
".",
"newStub",
"(",
"factory",
",",
"channel",
")",
";",
"}"
] | Creates a new async stub that supports all call types for the service | [
"Creates",
"a",
"new",
"async",
"stub",
"that",
"supports",
"all",
"call",
"types",
"for",
"the",
"service"
] | [] | [
{
"param": "channel",
"type": "io.grpc.Channel"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "channel",
"type": "io.grpc.Channel",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
4677,
7894,
11974,
394,
11974,
12,
1594,
18,
31674,
18,
2909,
1904,
13,
288,
203,
565,
2527,
18,
31674,
18,
12847,
18,
7469,
11974,
18,
11974,
1733,
32,
3371,
7894,
11974,
34,
3272,
273,
203,
1377,
394,
2527,
18,
31674,
18,
12847,
18,
7469,
11974,
18,
11974,
1733,
32,
3371,
7894,
11974,
34,
1435,
288,
203,
3639,
632,
6290,
18,
4936,
18,
6618,
203,
3639,
1071,
4677,
7894,
11974,
394,
11974,
12,
1594,
18,
31674,
18,
2909,
1904,
16,
2527,
18,
31674,
18,
1477,
1320,
745,
1320,
13,
288,
203,
1850,
327,
394,
4677,
7894,
11974,
12,
4327,
16,
745,
1320,
1769,
203,
3639,
289,
203,
1377,
289,
31,
203,
565,
327,
4677,
7894,
11974,
18,
2704,
11974,
12,
6848,
16,
1904,
1769,
203,
225,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
282,
380,
10210,
279,
394,
4326,
7168,
716,
6146,
777,
745,
1953,
364,
326,
1156,
203,
282,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
0e1dce5872fdef3e8f52ccff47ba40277d3b1c81 | jakeswenson/envelop | server/java/target/generated-sources/protobuf/grpc-java/com/godaddy/asherah/grpc/AppEncryptionGrpc.java | [
"MIT"
] | Java | newBlockingStub | AppEncryptionBlockingStub | public static AppEncryptionBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<AppEncryptionBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<AppEncryptionBlockingStub>() {
@java.lang.Override
public AppEncryptionBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new AppEncryptionBlockingStub(channel, callOptions);
}
};
return AppEncryptionBlockingStub.newStub(factory, channel);
} | /**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/ | Creates a new blocking-style stub that supports unary and streaming output calls on the service | [
"Creates",
"a",
"new",
"blocking",
"-",
"style",
"stub",
"that",
"supports",
"unary",
"and",
"streaming",
"output",
"calls",
"on",
"the",
"service"
] | public static AppEncryptionBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<AppEncryptionBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<AppEncryptionBlockingStub>() {
@java.lang.Override
public AppEncryptionBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new AppEncryptionBlockingStub(channel, callOptions);
}
};
return AppEncryptionBlockingStub.newStub(factory, channel);
} | [
"public",
"static",
"AppEncryptionBlockingStub",
"newBlockingStub",
"(",
"io",
".",
"grpc",
".",
"Channel",
"channel",
")",
"{",
"io",
".",
"grpc",
".",
"stub",
".",
"AbstractStub",
".",
"StubFactory",
"<",
"AppEncryptionBlockingStub",
">",
"factory",
"=",
"new",
"io",
".",
"grpc",
".",
"stub",
".",
"AbstractStub",
".",
"StubFactory",
"<",
"AppEncryptionBlockingStub",
">",
"(",
")",
"{",
"@",
"java",
".",
"lang",
".",
"Override",
"public",
"AppEncryptionBlockingStub",
"newStub",
"(",
"io",
".",
"grpc",
".",
"Channel",
"channel",
",",
"io",
".",
"grpc",
".",
"CallOptions",
"callOptions",
")",
"{",
"return",
"new",
"AppEncryptionBlockingStub",
"(",
"channel",
",",
"callOptions",
")",
";",
"}",
"}",
";",
"return",
"AppEncryptionBlockingStub",
".",
"newStub",
"(",
"factory",
",",
"channel",
")",
";",
"}"
] | Creates a new blocking-style stub that supports unary and streaming output calls on the service | [
"Creates",
"a",
"new",
"blocking",
"-",
"style",
"stub",
"that",
"supports",
"unary",
"and",
"streaming",
"output",
"calls",
"on",
"the",
"service"
] | [] | [
{
"param": "channel",
"type": "io.grpc.Channel"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "channel",
"type": "io.grpc.Channel",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
4677,
7894,
8728,
11974,
394,
8728,
11974,
12,
203,
1377,
2527,
18,
31674,
18,
2909,
1904,
13,
288,
203,
565,
2527,
18,
31674,
18,
12847,
18,
7469,
11974,
18,
11974,
1733,
32,
3371,
7894,
8728,
11974,
34,
3272,
273,
203,
1377,
394,
2527,
18,
31674,
18,
12847,
18,
7469,
11974,
18,
11974,
1733,
32,
3371,
7894,
8728,
11974,
34,
1435,
288,
203,
3639,
632,
6290,
18,
4936,
18,
6618,
203,
3639,
1071,
4677,
7894,
8728,
11974,
394,
11974,
12,
1594,
18,
31674,
18,
2909,
1904,
16,
2527,
18,
31674,
18,
1477,
1320,
745,
1320,
13,
288,
203,
1850,
327,
394,
4677,
7894,
8728,
11974,
12,
4327,
16,
745,
1320,
1769,
203,
3639,
289,
203,
1377,
289,
31,
203,
565,
327,
4677,
7894,
8728,
11974,
18,
2704,
11974,
12,
6848,
16,
1904,
1769,
203,
225,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
282,
380,
10210,
279,
394,
9445,
17,
4060,
7168,
716,
6146,
19017,
471,
12833,
876,
4097,
603,
326,
1156,
203,
282,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
0e1dce5872fdef3e8f52ccff47ba40277d3b1c81 | jakeswenson/envelop | server/java/target/generated-sources/protobuf/grpc-java/com/godaddy/asherah/grpc/AppEncryptionGrpc.java | [
"MIT"
] | Java | newFutureStub | AppEncryptionFutureStub | public static AppEncryptionFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<AppEncryptionFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<AppEncryptionFutureStub>() {
@java.lang.Override
public AppEncryptionFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new AppEncryptionFutureStub(channel, callOptions);
}
};
return AppEncryptionFutureStub.newStub(factory, channel);
} | /**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/ | Creates a new ListenableFuture-style stub that supports unary calls on the service | [
"Creates",
"a",
"new",
"ListenableFuture",
"-",
"style",
"stub",
"that",
"supports",
"unary",
"calls",
"on",
"the",
"service"
] | public static AppEncryptionFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<AppEncryptionFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<AppEncryptionFutureStub>() {
@java.lang.Override
public AppEncryptionFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new AppEncryptionFutureStub(channel, callOptions);
}
};
return AppEncryptionFutureStub.newStub(factory, channel);
} | [
"public",
"static",
"AppEncryptionFutureStub",
"newFutureStub",
"(",
"io",
".",
"grpc",
".",
"Channel",
"channel",
")",
"{",
"io",
".",
"grpc",
".",
"stub",
".",
"AbstractStub",
".",
"StubFactory",
"<",
"AppEncryptionFutureStub",
">",
"factory",
"=",
"new",
"io",
".",
"grpc",
".",
"stub",
".",
"AbstractStub",
".",
"StubFactory",
"<",
"AppEncryptionFutureStub",
">",
"(",
")",
"{",
"@",
"java",
".",
"lang",
".",
"Override",
"public",
"AppEncryptionFutureStub",
"newStub",
"(",
"io",
".",
"grpc",
".",
"Channel",
"channel",
",",
"io",
".",
"grpc",
".",
"CallOptions",
"callOptions",
")",
"{",
"return",
"new",
"AppEncryptionFutureStub",
"(",
"channel",
",",
"callOptions",
")",
";",
"}",
"}",
";",
"return",
"AppEncryptionFutureStub",
".",
"newStub",
"(",
"factory",
",",
"channel",
")",
";",
"}"
] | Creates a new ListenableFuture-style stub that supports unary calls on the service | [
"Creates",
"a",
"new",
"ListenableFuture",
"-",
"style",
"stub",
"that",
"supports",
"unary",
"calls",
"on",
"the",
"service"
] | [] | [
{
"param": "channel",
"type": "io.grpc.Channel"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "channel",
"type": "io.grpc.Channel",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
4677,
7894,
4118,
11974,
394,
4118,
11974,
12,
203,
1377,
2527,
18,
31674,
18,
2909,
1904,
13,
288,
203,
565,
2527,
18,
31674,
18,
12847,
18,
7469,
11974,
18,
11974,
1733,
32,
3371,
7894,
4118,
11974,
34,
3272,
273,
203,
1377,
394,
2527,
18,
31674,
18,
12847,
18,
7469,
11974,
18,
11974,
1733,
32,
3371,
7894,
4118,
11974,
34,
1435,
288,
203,
3639,
632,
6290,
18,
4936,
18,
6618,
203,
3639,
1071,
4677,
7894,
4118,
11974,
394,
11974,
12,
1594,
18,
31674,
18,
2909,
1904,
16,
2527,
18,
31674,
18,
1477,
1320,
745,
1320,
13,
288,
203,
1850,
327,
394,
4677,
7894,
4118,
11974,
12,
4327,
16,
745,
1320,
1769,
203,
3639,
289,
203,
1377,
289,
31,
203,
565,
327,
4677,
7894,
4118,
11974,
18,
2704,
11974,
12,
6848,
16,
1904,
1769,
203,
225,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
282,
380,
10210,
279,
394,
987,
7589,
4118,
17,
4060,
7168,
716,
6146,
19017,
4097,
603,
326,
1156,
203,
282,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
0e1dce5872fdef3e8f52ccff47ba40277d3b1c81 | jakeswenson/envelop | server/java/target/generated-sources/protobuf/grpc-java/com/godaddy/asherah/grpc/AppEncryptionGrpc.java | [
"MIT"
] | Java | session | null | public io.grpc.stub.StreamObserver<com.godaddy.asherah.grpc.AppEncryptionProtos.SessionRequest> session(
io.grpc.stub.StreamObserver<com.godaddy.asherah.grpc.AppEncryptionProtos.SessionResponse> responseObserver) {
return asyncBidiStreamingCall(
getChannel().newCall(getSessionMethod(), getCallOptions()), responseObserver);
} | /**
* <pre>
* Performs session operations for a single partition.
* Each session must begin with a GetSession message with all subsequent
* Encrypt and Decrypt operations scoped its partition.
* </pre>
*/ |
Performs session operations for a single partition.
Each session must begin with a GetSession message with all subsequent
Encrypt and Decrypt operations scoped its partition. | [
"Performs",
"session",
"operations",
"for",
"a",
"single",
"partition",
".",
"Each",
"session",
"must",
"begin",
"with",
"a",
"GetSession",
"message",
"with",
"all",
"subsequent",
"Encrypt",
"and",
"Decrypt",
"operations",
"scoped",
"its",
"partition",
"."
] | public io.grpc.stub.StreamObserver<com.godaddy.asherah.grpc.AppEncryptionProtos.SessionRequest> session(
io.grpc.stub.StreamObserver<com.godaddy.asherah.grpc.AppEncryptionProtos.SessionResponse> responseObserver) {
return asyncBidiStreamingCall(
getChannel().newCall(getSessionMethod(), getCallOptions()), responseObserver);
} | [
"public",
"io",
".",
"grpc",
".",
"stub",
".",
"StreamObserver",
"<",
"com",
".",
"godaddy",
".",
"asherah",
".",
"grpc",
".",
"AppEncryptionProtos",
".",
"SessionRequest",
">",
"session",
"(",
"io",
".",
"grpc",
".",
"stub",
".",
"StreamObserver",
"<",
"com",
".",
"godaddy",
".",
"asherah",
".",
"grpc",
".",
"AppEncryptionProtos",
".",
"SessionResponse",
">",
"responseObserver",
")",
"{",
"return",
"asyncBidiStreamingCall",
"(",
"getChannel",
"(",
")",
".",
"newCall",
"(",
"getSessionMethod",
"(",
")",
",",
"getCallOptions",
"(",
")",
")",
",",
"responseObserver",
")",
";",
"}"
] | <pre>
Performs session operations for a single partition. | [
"<pre",
">",
"Performs",
"session",
"operations",
"for",
"a",
"single",
"partition",
"."
] | [] | [
{
"param": "responseObserver",
"type": "io.grpc.stub.StreamObserver<com.godaddy.asherah.grpc.AppEncryptionProtos.SessionResponse>"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "responseObserver",
"type": "io.grpc.stub.StreamObserver<com.godaddy.asherah.grpc.AppEncryptionProtos.SessionResponse>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
2527,
18,
31674,
18,
12847,
18,
1228,
11048,
32,
832,
18,
75,
369,
31934,
18,
961,
6070,
76,
18,
31674,
18,
3371,
7894,
626,
14627,
18,
2157,
691,
34,
1339,
12,
203,
3639,
2527,
18,
31674,
18,
12847,
18,
1228,
11048,
32,
832,
18,
75,
369,
31934,
18,
961,
6070,
76,
18,
31674,
18,
3371,
7894,
626,
14627,
18,
2157,
1064,
34,
766,
11048,
13,
288,
203,
1377,
327,
4326,
17763,
77,
15973,
1477,
12,
203,
1850,
16454,
7675,
2704,
1477,
12,
588,
2157,
1305,
9334,
336,
1477,
1320,
1435,
3631,
766,
11048,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
411,
1484,
34,
203,
377,
380,
27391,
1339,
5295,
364,
279,
2202,
3590,
18,
203,
377,
380,
8315,
1339,
1297,
2376,
598,
279,
23994,
883,
598,
777,
10815,
203,
377,
380,
19612,
471,
22411,
5295,
12523,
2097,
3590,
18,
203,
377,
380,
7765,
1484,
34,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |