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
54d7150a
Commit
54d7150a
authored
Jun 12, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added clarifying comments.
parent
a2b6ed16
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
sequence_segmenter.py
python_examples/sequence_segmenter.py
+4
-2
No files found.
python_examples/sequence_segmenter.py
View file @
54d7150a
...
@@ -77,8 +77,8 @@ def print_segment(sentence, names):
...
@@ -77,8 +77,8 @@ def print_segment(sentence, names):
# Now lets make some training data. Each example is a sentence as well as a set of ranges
# Now lets make some training data. Each example is a sentence as well as a set of ranges
# which indicate the locations of any names.
# which indicate the locations of any names.
names
=
dlib
.
ranges
()
names
=
dlib
.
ranges
()
# make an array of dlib.range objects.
segments
=
dlib
.
rangess
()
segments
=
dlib
.
rangess
()
# make an array of arrays of dlib.range objects.
sentences
=
[]
sentences
=
[]
...
@@ -126,10 +126,12 @@ names.clear()
...
@@ -126,10 +126,12 @@ names.clear()
# representation depending on our needs. In this example, we show how to do it both ways.
# representation depending on our needs. In this example, we show how to do it both ways.
use_sparse_vects
=
False
use_sparse_vects
=
False
if
use_sparse_vects
:
if
use_sparse_vects
:
# Make an array of arrays of dlib.sparse_vector objects.
training_sequences
=
dlib
.
sparse_vectorss
()
training_sequences
=
dlib
.
sparse_vectorss
()
for
s
in
sentences
:
for
s
in
sentences
:
training_sequences
.
append
(
sentence_to_sparse_vectors
(
s
))
training_sequences
.
append
(
sentence_to_sparse_vectors
(
s
))
else
:
else
:
# Make an array of arrays of dlib.vector objects.
training_sequences
=
dlib
.
vectorss
()
training_sequences
=
dlib
.
vectorss
()
for
s
in
sentences
:
for
s
in
sentences
:
training_sequences
.
append
(
sentence_to_vectors
(
s
))
training_sequences
.
append
(
sentence_to_vectors
(
s
))
...
...
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