V
V
Vitaly2020-10-18 14:01:01
Python
Vitaly, 2020-10-18 14:01:01

How to use NLP to recognize the names of the start and end points of the route?

1. "How to get from Moscow to St. Petersburg?"
2. "How long will it take to get to the Vitebsk railway station in St. Petersburg, I'm leaving Tula tomorrow at noon?"

How do you train a machine to understand a start and end point when the phrase can be constructed in any manner?
You need to use machine learning. I want to try https://spacy.io/usage

Let's say if you parse the names of all cities, stations, stops, then ok. But how do you let the machine know that in phrase 1, the starting point is in the first place (the ending point is in the second), and vice versa in phrase 2?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Ilyin, 2020-10-19
@sunsexsurf

firstly, indeed, you need to solve the NER problem, that is, get the title from the string. This can, for example, the Natasha library (link to github).
Then, as an option, do this: if the object is preceded by "from" - this means the starting point, if "to" - the end point. But this is the second task, which is solved not by ML, but by the selection of linguistic rules, rather.

X
xmoonlight, 2020-10-24
@xmoonlight

IF "from/from/from": % verb% % preposition: "from/from/from"% [% from%] (to get from Moscow, leaving Tula)
ELSE: % noun% % preposition% [% to%] (Moscow to St. Petersburg, the road to the Vitebsk railway station)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question