Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
2e4e37dc
Commit
2e4e37dc
authored
Nov 11, 2012
by
Davis King
Browse files
made code a little clearer
parent
249b0dd1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
dlib/optimization/find_max_parse_cky.h
dlib/optimization/find_max_parse_cky.h
+13
-13
dlib/optimization/find_max_parse_cky_abstract.h
dlib/optimization/find_max_parse_cky_abstract.h
+2
-2
No files found.
dlib/optimization/find_max_parse_cky.h
View file @
2e4e37dc
...
...
@@ -238,7 +238,7 @@ namespace dlib
template
<
bool
print_tag
,
typename
T
,
typename
U
>
void
print_parse_tree_helper
(
const
std
::
vector
<
parse_tree_element
<
T
>
>&
tree
,
const
std
::
vector
<
U
>&
item
s
,
const
std
::
vector
<
U
>&
word
s
,
unsigned
long
i
,
std
::
ostream
&
out
)
...
...
@@ -254,19 +254,19 @@ namespace dlib
if
(
tree
[
i
].
left
<
tree
.
size
())
{
left_recurse
=
true
;
print_parse_tree_helper
<
print_tag
>
(
tree
,
item
s
,
tree
[
i
].
left
,
out
);
print_parse_tree_helper
<
print_tag
>
(
tree
,
word
s
,
tree
[
i
].
left
,
out
);
}
else
{
if
(
tree
[
i
].
c
.
begin
<
item
s
.
size
())
if
(
tree
[
i
].
c
.
begin
<
word
s
.
size
())
{
out
<<
item
s
[
tree
[
i
].
c
.
begin
]
<<
" "
;
out
<<
word
s
[
tree
[
i
].
c
.
begin
]
<<
" "
;
}
else
{
std
::
ostringstream
sout
;
sout
<<
"Parse tree refers to element "
<<
tree
[
i
].
c
.
begin
<<
" of sequence which is only of size "
<<
item
s
.
size
()
<<
"."
;
<<
" of sequence which is only of size "
<<
word
s
.
size
()
<<
"."
;
throw
parse_tree_to_string_error
(
sout
.
str
());
}
}
...
...
@@ -276,19 +276,19 @@ namespace dlib
if
(
left_recurse
==
true
)
out
<<
" "
;
print_parse_tree_helper
<
print_tag
>
(
tree
,
item
s
,
tree
[
i
].
right
,
out
);
print_parse_tree_helper
<
print_tag
>
(
tree
,
word
s
,
tree
[
i
].
right
,
out
);
}
else
{
if
(
tree
[
i
].
c
.
k
<
item
s
.
size
())
if
(
tree
[
i
].
c
.
k
<
word
s
.
size
())
{
out
<<
item
s
[
tree
[
i
].
c
.
k
];
out
<<
word
s
[
tree
[
i
].
c
.
k
];
}
else
{
std
::
ostringstream
sout
;
sout
<<
"Parse tree refers to element "
<<
tree
[
i
].
c
.
k
<<
" of sequence which is only of size "
<<
item
s
.
size
()
<<
"."
;
<<
" of sequence which is only of size "
<<
word
s
.
size
()
<<
"."
;
throw
parse_tree_to_string_error
(
sout
.
str
());
}
}
...
...
@@ -303,14 +303,14 @@ namespace dlib
template
<
typename
T
,
typename
U
>
std
::
string
parse_tree_to_string
(
const
std
::
vector
<
parse_tree_element
<
T
>
>&
tree
,
const
std
::
vector
<
U
>&
item
s
const
std
::
vector
<
U
>&
word
s
)
{
if
(
tree
.
size
()
==
0
)
return
""
;
std
::
ostringstream
sout
;
impl
::
print_parse_tree_helper
<
false
>
(
tree
,
item
s
,
0
,
sout
);
impl
::
print_parse_tree_helper
<
false
>
(
tree
,
word
s
,
0
,
sout
);
return
sout
.
str
();
}
...
...
@@ -319,14 +319,14 @@ namespace dlib
template
<
typename
T
,
typename
U
>
std
::
string
parse_tree_to_string_tagged
(
const
std
::
vector
<
parse_tree_element
<
T
>
>&
tree
,
const
std
::
vector
<
U
>&
item
s
const
std
::
vector
<
U
>&
word
s
)
{
if
(
tree
.
size
()
==
0
)
return
""
;
std
::
ostringstream
sout
;
impl
::
print_parse_tree_helper
<
true
>
(
tree
,
item
s
,
0
,
sout
);
impl
::
print_parse_tree_helper
<
true
>
(
tree
,
word
s
,
0
,
sout
);
return
sout
.
str
();
}
...
...
dlib/optimization/find_max_parse_cky_abstract.h
View file @
2e4e37dc
...
...
@@ -136,7 +136,7 @@ namespace dlib
template
<
typename
T
,
typename
U
>
std
::
string
parse_tree_to_string
(
const
std
::
vector
<
parse_tree_element
<
T
>
>&
tree
,
const
std
::
vector
<
U
>&
item
s
const
std
::
vector
<
U
>&
word
s
);
/*!
ensures
...
...
@@ -148,7 +148,7 @@ namespace dlib
template
<
typename
T
,
typename
U
>
std
::
string
parse_tree_to_string_tagged
(
const
std
::
vector
<
parse_tree_element
<
T
>
>&
tree
,
const
std
::
vector
<
U
>&
item
s
const
std
::
vector
<
U
>&
word
s
);
/*!
ensures
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment