0

I am looking for help on a portion of a program I am trying to develop. I recently implemented a naive version of a text searching program that stored tokenized sentences in a list, and searched for phrases using if statements. This process worked but took an extremely long time to complete. I found the Trie data structure and from my research it is capable of substantially cutting down my run-time. I was wondering if anyone has an idea about using a Trie to search for phrases in a list of tokenized sentences. And after matching, returning the entire sentence with the sought after key phrase in it. By the way all the text is in string format.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
  • Could you provide some code examples? – sur0k Sep 27 '21 at 23:21
  • What might be best is to take some trie library or [create](https://stackoverflow.com/questions/11015320/how-to-create-a-trie-in-python) one yourself and make an attempt. Post any issues you have here. – Paul Rooney Sep 28 '21 at 00:32
  • Thank you, I think I'll continue developing one on my own and just post the code if I continue to run into issues – Nnemeka300 Sep 28 '21 at 13:54

1 Answers1

0

I use a library for python that allows you to create and search through Tries, if you wanted to just import the data structure here's a link to where you can download it. https://pypi.org/project/marisa-trie/

bsig1
  • 16
  • 1