fixed more grammar

pull/2/head
Davis King 11 years ago
parent 114f677d74
commit 9b16325df6

@ -17,14 +17,14 @@
import dlib
# Lets imagine you need to assign N people to N jobs. Additionally, each person will make
# Let's imagine you need to assign N people to N jobs. Additionally, each person will make
# your company a certain amount of money at each job, but each person has different skills
# so they are better at some jobs and worse at others. You would like to find the best way
# to assign people to these jobs. In particular, you would like to maximize the amount of
# money the group makes as a whole. This is an example of an assignment problem and is
# what is solved by the dlib.max_cost_assignment() routine.
# So in this example, lets imagine we have 3 people and 3 jobs. We represent the amount of
# So in this example, let's imagine we have 3 people and 3 jobs. We represent the amount of
# money each person will produce at each job with a cost matrix. Each row corresponds to a
# person and each column corresponds to a job. So for example, below we are saying that
# person 0 will make $1 at job 0, $2 at job 1, and $6 at job 2.

@ -78,7 +78,7 @@ def print_segment(sentence, names):
# Now lets make some training data. Each example is a sentence as well as a set of ranges
# Now let's make some training data. Each example is a sentence as well as a set of ranges
# which indicate the locations of any names.
names = dlib.ranges() # make an array of dlib.range objects.
segments = dlib.rangess() # make an array of arrays of dlib.range objects.
@ -159,13 +159,13 @@ params.C = 10
model = dlib.train_sequence_segmenter(training_sequences, segments, params)
# Lets print out the things the model thinks are names. The output is a set of ranges
# Let's print out the things the model thinks are names. The output is a set of ranges
# which are predicted to contain names. If you run this example program you will see that
# it gets them all correct.
for i in range(len(sentences)):
print_segment(sentences[i], model(training_sequences[i]))
# Lets also try segmenting a new sentence. This will print out "Bob Bucket". Note that we
# Let's also try segmenting a new sentence. This will print out "Bob Bucket". Note that we
# need to remember to use the same vector representation as we used during training.
test_sentence = "There once was a man from Nantucket whose name rhymed with Bob Bucket"
if use_sparse_vects:

@ -25,7 +25,7 @@
import dlib
# Now lets make some testing data. To make it really simple, lets suppose that
# Now let's make some testing data. To make it really simple, let's suppose that
# we are ranking 2D vectors and that vectors with positive values in the first
# dimension should rank higher than other vectors. So what we do is make
# examples of relevant (i.e. high ranking) and non-relevant (i.e. low ranking)
@ -47,7 +47,7 @@ trainer = dlib.svm_rank_trainer()
# selecting a "simpler" solution which might generalize better.
trainer.c = 10
# So lets do the training.
# So let's do the training.
rank = trainer.train(data)
# Now if you call rank on a vector it will output a ranking score. In

Loading…
Cancel
Save