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
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
- 01
- 12
Two pieces cost less than the complete word
This check uses the pieces from “Choose a complete segmentation by total cost”.
BOTIE
- 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 →