Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
2e4e37dc
Commit
2e4e37dc
authored
Nov 12, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made code a little clearer
parent
249b0dd1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
find_max_parse_cky.h
dlib/optimization/find_max_parse_cky.h
+13
-13
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