sentence-splitter
Version:
split {japanese, english} text into sentences.
22 lines (19 loc) • 494 B
text/typescript
import { SourceCode } from "./SourceCode.js";
import { AbstractParser } from "./AbstractParser.js";
/**
* New Line Parser
*/
export class NewLineParser implements AbstractParser {
test(sourceCode: SourceCode) {
const string = sourceCode.read();
if (!string) {
return false;
}
return /[\r\n]/.test(string);
}
seek(sourceCode: SourceCode): void {
while (this.test(sourceCode)) {
sourceCode.peek();
}
}
}