/SearchController.java Secret
Created
December 1, 2022 16:42
Star
You must be signed in to star a gist
ShareToRoku normalization pipeline
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
public RokuSearchInfo parse(String input, UserChannelSet channels) { | |
// 1. PARSE | |
String trimmed = input.trim(); | |
RokuSearchInfo info = null; | |
try { | |
info = tvdbParser.parse(input, channels); | |
if (info == null) info = urlParser.parse(input, channels); | |
if (info == null) info = syntaxParser.parse(input, channels); | |
} | |
catch (Exception eParse) { | |
log.warning(Easy.exMsg(eParse, "parsers", true)); | |
info = null; | |
} | |
if (info == null) { | |
info = new RokuSearchInfo(); | |
info.Search = trimmed; | |
log.info("Default RokuSearchInfo: " + info.toString()); | |
} | |
// 2. REFINE | |
tryRefine(info, channels, rokuRefiner, "rokuRefiner"); | |
tryRefine(info, channels, wikiRefiner, "wikiRefiner"); | |
tryRefine(info, channels, fixupRefiner, "fixupRefiner"); | |
// 3. RETURN | |
log.info(String.format("FINAL [%s] -> %s", trimmed, info)); | |
return(info); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment