forked from opentripplanner/OpenTripPlanner
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/dev-2.x' into upstream-merge-2…
…023-10-20
- Loading branch information
Showing
127 changed files
with
3,503 additions
and
1,294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest a feature or improvement for OTP | ||
title: '' | ||
labels: new feature | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] --> | ||
|
||
**Goal / high level use-case** | ||
<!-- Describe the the goal, high level use-case or epic this is is part of. Link to roadmap epic --> | ||
<!-- Roadmap: #1234 --> | ||
|
||
**Describe the solution you'd like** | ||
<!-- A clear and concise description of what you want to happen. --> | ||
|
||
**Describe alternatives you've considered** | ||
<!-- A clear and concise description of any alternative solutions or features you've considered. --> | ||
|
||
**Additional context** | ||
<!-- Add any other context or screenshots about the feature request here. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
name: Roadmap Epic | ||
about: Suggest an idea for the Roadmap | ||
title: '' | ||
labels: Roadmap | ||
assignees: '' | ||
|
||
--- | ||
|
||
### Describe expected behavior: | ||
- What: <!-- Clearly state what the desired changes or new features could look like. --> | ||
- Why: <!-- Clearly state the effect/outcome of this change. --> | ||
- When: <!-- Provide a timeline or timeframe for when these changes should be implemented, preferably on a quarterly basis (e.g., Y24 Q3). --> | ||
|
||
### Linked issue(s) | ||
<!-- Add a checkbox by typing “- [] ”. Then, link to an issue by typing “#” and searching for the issue by text or issue number, or create a new issue. --> | ||
|
||
### OTP PO Discussion meeting details: | ||
- Date: <!-- Specify the date when the discussion meeting took place. --> | ||
- Link(s): <!-- Provide a link or location where the discussion notes or details can be found. This could be a meeting link or another document. --> | ||
|
||
### Extra Comments (Optional) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
src/ext-test/java/org/opentripplanner/ext/geocoder/EnglishNgramAnalyzerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package org.opentripplanner.ext.geocoder; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.apache.lucene.analysis.Analyzer; | ||
import org.apache.lucene.analysis.TokenStream; | ||
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class EnglishNgramAnalyzerTest { | ||
|
||
@Test | ||
void ngram() throws IOException { | ||
var analyzer = new EnglishNGramAnalyzer(); | ||
List<String> result = analyze("Alexanderplatz", analyzer); | ||
|
||
//System.out.println(result.stream().collect(Collectors.joining("\",\"", "\"", "\""))); | ||
assertEquals( | ||
List.of( | ||
"Alex", | ||
"Alexa", | ||
"Alexan", | ||
"Alexand", | ||
"Alexande", | ||
"Alexander", | ||
"Alexanderp", | ||
"lexa", | ||
"lexan", | ||
"lexand", | ||
"lexande", | ||
"lexander", | ||
"lexanderp", | ||
"lexanderpl", | ||
"exan", | ||
"exand", | ||
"exande", | ||
"exander", | ||
"exanderp", | ||
"exanderpl", | ||
"exanderpla", | ||
"xand", | ||
"xande", | ||
"xander", | ||
"xanderp", | ||
"xanderpl", | ||
"xanderpla", | ||
"xanderplat", | ||
"ande", | ||
"ander", | ||
"anderp", | ||
"anderpl", | ||
"anderpla", | ||
"anderplat", | ||
"anderplatz", | ||
"nder", | ||
"nderp", | ||
"nderpl", | ||
"nderpla", | ||
"nderplat", | ||
"nderplatz", | ||
"derp", | ||
"derpl", | ||
"derpla", | ||
"derplat", | ||
"derplatz", | ||
"erpl", | ||
"erpla", | ||
"erplat", | ||
"erplatz", | ||
"rpla", | ||
"rplat", | ||
"rplatz", | ||
"plat", | ||
"platz", | ||
"latz", | ||
"Alexanderplatz" | ||
), | ||
result | ||
); | ||
} | ||
|
||
public List<String> analyze(String text, Analyzer analyzer) throws IOException { | ||
List<String> result = new ArrayList<>(); | ||
TokenStream tokenStream = analyzer.tokenStream("name", text); | ||
CharTermAttribute attr = tokenStream.addAttribute(CharTermAttribute.class); | ||
tokenStream.reset(); | ||
while (tokenStream.incrementToken()) { | ||
result.add(attr.toString()); | ||
} | ||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.