CouncilDataProject / cdptools_v2

Tools you can use to interact with and run Council Data Project instances.
Other
7 stars 9 forks source link

feature/add-get-context-span-utility #115

Closed evamaxfield closed 4 years ago

evamaxfield commented 4 years ago

Pull request recommendations:

Work in progress for #79

Working on #79. The contexts portion for each index term will eventually be useful for the returns from search results. Google, shows you the metadata for each event but we have too much of that to show all of it. This contextual sentence span will be used in place of that. So the user types in their query and for each result they are shown why that event was returned. "Because that query was found in this event in this place"

To get this working though we needed a function to make a balanced list both left and right of a given index for a list of ordered terms (basically get_raw_transcript(transcript).split(" ")), and return either the ten surrounding terms not including end of sentence markings. So if the index is closer to the end of the sentence it would hit the end of the sentence and then pull from the left side. Basically, the system should always try to pull n amount of terms but if both ends of the sentence are hit then stop.

Thanks for contributing!