Natural Language Processing

Find the cheaper complete route

The letters stay fixed while path costs change

Botie has costs for competing text pieces. A promising first piece can lead to an expensive remainder, so the decision needs to cover the whole input.

BOTIE

Why should the preferred route change when only the supplied costs change?
The inputs we are comparing

Text

Same in both cases

abcd

Piece costs

Example 1

{
  "ab": 1,
  "cd": 2,
  "a": 1,
  "bcd": 4
}

Example 2

{
  "ab": 4,
  "cd": 3,
  "a": 1,
  "bcd": 2
}

Piece IDs

Same in both cases

{
  "ab": 1,
  "cd": 2,
  "a": 3,
  "bcd": 4
}
Result for example 1
  1. 01
  2. 12
Choose an explanation to test
Two pieces cost less than the complete word

This check uses the pieces from “Choose a complete segmentation by total cost”.

BOTIE

Both the complete word and a two-piece route cover pineapple. Return the IDs on the lowest-total-cost route using the supplied piece costs. Fewest pieces is not the objective.
Text
pineapple
Piece costs
{
  "pine": 0.4,
  "apple": 0.4,
  "pineapple": 1.3
}
Piece IDs
{
  "pine": 4,
  "apple": 7,
  "pineapple": 9
}

Use a number, text, or an array matching the requested result. For a matrix, put each row in brackets. Saving your prediction runs your current construction on these inputs and checks the earlier examples too.

Build a construction in the workspace above first. This case will test those pieces.

How can a cheap first piece still belong to the more expensive full route?

When later choices depend on earlier ones, compare complete paths using an explicit objective.

This is a small construction problem. The lesson explains the assumptions and the parts of the full method that this example leaves out.

Work through the Python challenges →
Continue the courseSegmenting With a Hidden Model →
← Maximum Matching