Skip to content

Commit 213e44a

Browse files
committed
typo in python; --dep-delimit for conv
1 parent 5836535 commit 213e44a

File tree

6 files changed

+18
-1
lines changed

6 files changed

+18
-1
lines changed

python/cg3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Cohort:
1616
static: Reading = field(default_factory=Reading)
1717
readings: List[Reading] = field(default_factory=list)
1818
dep_self: int = 0
19-
dep_head: Optional[int] = None
19+
dep_parent: Optional[int] = None
2020
relations: DefaultDict[str, List[int]] = field(
2121
default_factory=lambda: defaultdict(list))
2222
text: str = ''

src/GrammarApplicator.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,9 @@ void GrammarApplicator::setOptions(UConverter* conv) {
10091009
if (options[PRINT_IDS].doesOccur) {
10101010
print_ids = true;
10111011
}
1012+
if (options[PRINT_DEP].doesOccur) {
1013+
has_dep = true;
1014+
}
10121015
if (options[NUM_WINDOWS].doesOccur) {
10131016
num_windows = std::stoul(options[NUM_WINDOWS].value);
10141017
}

src/cg-conv.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,15 @@ int main(int argc, char* argv[]) {
232232
applicator.parse_dep = true;
233233
applicator.has_dep = true;
234234
}
235+
if (options_conv[DEP_DELIMIT].doesOccur) {
236+
if (!options_conv[DEP_DELIMIT].value.empty()) {
237+
applicator.dep_delimit = std::stoul(options_conv[DEP_DELIMIT].value);
238+
}
239+
else {
240+
applicator.dep_delimit = 10;
241+
}
242+
applicator.parse_dep = true;
243+
}
235244
applicator.is_conv = true;
236245
applicator.trace = true;
237246
applicator.verbosity_level = 0;

src/options.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ options_t options{
7373
UOption{"unicode-tags", 0, UOPT_NO_ARG, "outputs Unicode code points for things like ->"},
7474
UOption{"unique-tags", 0, UOPT_NO_ARG, "outputs unique tags only once per reading"},
7575
UOption{"print-ids", 0, UOPT_NO_ARG, "always output IDs"},
76+
UOption{"print-dep", 0, UOPT_NO_ARG, "always output dependencies"},
7677

7778
UOption{"num-windows", 0, UOPT_REQUIRES_ARG, "number of windows to keep in before/ahead buffers; defaults to 2"},
7879
UOption{"always-span", 0, UOPT_NO_ARG, "forces scanning tests to always span across window boundaries"},

src/options.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ enum OPTIONS {
7171
UNICODE_TAGS,
7272
UNIQUE_TAGS,
7373
PRINT_IDS,
74+
PRINT_DEP,
7475
NUM_WINDOWS,
7576
ALWAYS_SPAN,
7677
SOFT_LIMIT,

src/options_conv.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace OptionsConv {
2727

2828
using ::Options::UOption;
2929
using ::Options::UOPT_NO_ARG;
30+
using ::Options::UOPT_OPTIONAL_ARG;
3031
using ::Options::UOPT_REQUIRES_ARG;
3132

3233
enum OPTIONS {
@@ -59,6 +60,7 @@ enum OPTIONS {
5960
SUB_LTR,
6061
ORDERED,
6162
PARSE_DEP,
63+
DEP_DELIMIT,
6264
UNICODE_TAGS,
6365
PIPE_DELETED,
6466
NO_BREAK,
@@ -95,6 +97,7 @@ std::array<UOption, NUM_OPTIONS_CONV> options_conv{
9597
UOption{"ltr", 'l', UOPT_NO_ARG, "sets sub-reading direction to LTR"},
9698
UOption{"ordered", 'o', UOPT_NO_ARG, "tag order matters mode"},
9799
UOption{"parse-dep", 'D', UOPT_NO_ARG, "parse dependency (defaults to treating as normal tags)"},
100+
UOption{"dep-delimit", 0, UOPT_OPTIONAL_ARG, "delimit windows based on dependency; defaults to 10"},
98101
UOption{"unicode-tags", 0, UOPT_NO_ARG, "outputs Unicode code points for things like ->"},
99102
UOption{"deleted", 0, UOPT_NO_ARG, "read deleted readings as such, instead of as text"},
100103
UOption{"no-break", 'B', UOPT_NO_ARG, "inhibits any extra whitespace in output"},

0 commit comments

Comments
 (0)