PageRenderTime 58ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/src/spelling/corrector/CorrectorBuilder.java

https://github.com/juliengrenier/java-spelling-corrector
Java | 23 lines | 19 code | 4 blank | 0 comment | 2 complexity | 13e28f1b7482c68a29ff6929eb1c151e MD5 | raw file
  1. package spelling.corrector;
  2. public class CorrectorBuilder {
  3. private static SpellingCorrectorHelper buildHelper(boolean isVerbose){
  4. SpellingCorrectorHelper helper = new DefaultSpellingCorrectorHelper();
  5. if(isVerbose){
  6. return new StatSpellingCorrectorHelper(helper);
  7. }else{
  8. return helper;
  9. }
  10. }
  11. public static SpellingCorrector buildCorrector(boolean isVerbose){
  12. SpellingCorrector corrector = new DefaultSpellingCorrector(buildHelper(isVerbose));
  13. if(isVerbose){
  14. return new StatSpellingCorrector(corrector);
  15. }else{
  16. return corrector;
  17. }
  18. }
  19. }