Puzzles, Maths and Algorithms: Finding Relevant Keywords from Large Corpus of Text
Finding Relevant Keywords from Large Corpus of Text
Problem 1: Given a large paragraph of words containing n words (separated by space), and k keywords. Find the smallest distance between these keywords in the paragraph.
To illustrate the problem, consider that the paragraph is A B A C E D O A B. Let us say that we are interested in two keywords A and D. Then the closest they appear is at position 8 and 6 (D O A) and the minimum distance is 1 (i.e. number of non-keyword words between them).
Build an efficient algorithm with O(k) space and O(n log k) running cost.
To illustrate the problem, consider that the paragraph is A B A C E D O A B. Let us say that we are interested in two keywords A and D. Then the closest they appear is at position 8 and 6 (D O A) and the minimum distance is 1 (i.e. number of non-keyword words between them).
Build an efficient algorithm with O(k) space and O(n log k) running cost.
Read full article from Puzzles, Maths and Algorithms: Finding Relevant Keywords from Large Corpus of Text
No comments:
Post a Comment