Skip to content

Modifying logic to generate passages from search result document - #33

Merged
msfroh merged 1 commit into
opensearch-project:mainfrom
kevinawskendra:passage-splitting
Nov 23, 2022
Merged

Modifying logic to generate passages from search result document#33
msfroh merged 1 commit into
opensearch-project:mainfrom
kevinawskendra:passage-splitting

Conversation

@mahitamahesh

@mahitamahesh mahitamahesh commented Nov 23, 2022

Copy link
Copy Markdown
Contributor

Signed-off-by: Mahita Mahesh mahitam@amazon.com

Description

Compared to the previous logic, this change adds:

  • More filters and transformations during tokenization
  • Simplifies sentence splitting logic
  • Generates passages with overlap

Issues Resolved

N/A

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed as per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@codecov-commenter

codecov-commenter commented Nov 23, 2022

Copy link
Copy Markdown

Codecov Report

Merging #33 (7577099) into main (ae550aa) will increase coverage by 3.56%.
The diff coverage is 92.80%.

@@             Coverage Diff              @@
##               main      #33      +/-   ##
============================================
+ Coverage     56.87%   60.43%   +3.56%     
- Complexity      129      155      +26     
============================================
  Files            28       29       +1     
  Lines           800      867      +67     
  Branches        105      119      +14     
============================================
+ Hits            455      524      +69     
+ Misses          308      304       -4     
- Partials         37       39       +2     
Impacted Files Coverage Δ
...draintelligentranking/KendraIntelligentRanker.java 67.32% <75.00%> (-2.15%) ⬇️
...raintelligentranking/preprocess/TextTokenizer.java 93.18% <91.66%> (+5.68%) ⬆️
...ntelligentranking/preprocess/PassageGenerator.java 96.00% <96.00%> (ø)
...ntelligentranking/preprocess/SentenceSplitter.java 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@mahitamahesh
mahitamahesh marked this pull request as ready for review November 23, 2022 17:54
@mahitamahesh
mahitamahesh requested a review from a team November 23, 2022 17:54
if (token == null) {
return null;
}
return token.replaceAll(PUNCTUATIONS_REGEX_PATTERN, "");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you compile the regex once into a static final Pattern, and replace this with:

PUNCTUATIONS_REGEX.matcher(token).replaceAll("");

As written, this will compile the regex on every token.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! I changed the one above and missed this one.. thanks for catching!

Signed-off-by: Mahita Mahesh <mahitam@amazon.com>
@msfroh
msfroh merged commit 89ca332 into opensearch-project:main Nov 23, 2022
msfroh pushed a commit that referenced this pull request Nov 23, 2022
Signed-off-by: Mahita Mahesh <mahitam@amazon.com>
@mingshl mingshl added the enhancement change or upgrade that increases software capabilities beyond original client specifications label Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement change or upgrade that increases software capabilities beyond original client specifications

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants