Skip to content
Snippets Groups Projects
Commit c8c9114f authored by Ruben Bimberg's avatar Ruben Bimberg :computer:
Browse files

Fix parenthesis around words

parent c0bc3f11
No related merge requests found
...@@ -20,7 +20,7 @@ import { RoomDataService } from './room-data.service'; ...@@ -20,7 +20,7 @@ import { RoomDataService } from './room-data.service';
const words = [ const words = [
'frage', 'antwort', 'aufgabe', 'hallo', 'test', 'bzw', 'bzw.', 'muss', 'more to come', 'mal', 'zb', 'zb\\.', 'frage', 'antwort', 'aufgabe', 'hallo', 'test', 'bzw', 'bzw.', 'muss', 'more to come', 'mal', 'zb', 'zb\\.',
'z\\.\\s*b\\.', 'zum beispiel', 'beispiel', 'jeder?', 'jede/r', 'bisschen', 'bißchen', 'okay', 'ok', 'o.k.', '', 'z\\.\\s*b\\.', 'zum beispiel', 'beispiel', 'jeder?', 'jede/r', 'bisschen', 'bißchen', 'okay', 'ok', 'o.k.', '',
'\\\\', '\\/', '(medien-)?pädagogik' '\\\\', '\\/'
]; ];
export const regexMaskKeyword = new RegExp('\\b(' + words.join('|') + ')\\b', 'gmi'); export const regexMaskKeyword = new RegExp('\\b(' + words.join('|') + ')\\b', 'gmi');
......
...@@ -30,6 +30,11 @@ export class CreateCommentKeywords { ...@@ -30,6 +30,11 @@ export class CreateCommentKeywords {
} }
private static escapeForSpacy(text: string): string { private static escapeForSpacy(text: string): string {
text = this.makeCapslockLowercase(text);
return text.replace(/\(([^-\s)]+-)\)([^\s]+)/gmi, '$1$2');
}
private static makeCapslockLowercase(text: string): string {
const upperText = text.toUpperCase(); const upperText = text.toUpperCase();
const regex = /\s+|$/gmi; const regex = /\s+|$/gmi;
let m: RegExpExecArray; let m: RegExpExecArray;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment