Blame view

tokenizer/ENIAMtokenizer.ml 1.56 KB
Wojciech Jaworski authored
1
2
3
4
5
6
7
8
9
10
11
12
13
(*
 *  ENIAMtokenizer, a tokenizer for Polish
 *  Copyright (C) 2016 Wojciech Jaworski <wjaworski atSPAMfree mimuw dot edu dot pl>
 *  Copyright (C) 2016 Institute of Computer Science Polish Academy of Sciences
 *
 *  This library is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Wojciech Jaworski authored
14
 *  GNU Lesser General Public License for more details.
Wojciech Jaworski authored
15
16
17
18
19
20
21
22
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *)

open Xstd
open ENIAMtokenizerTypes
Wojciech Jaworski authored
23
24
25
let initialize () =
  ENIAMacronyms.mte_patterns := ENIAMacronyms.load_mte_patterns ()
Wojciech Jaworski authored
26
27
28
29
30
31
32
33
34
let string_of =
  ENIAMtokens.string_of_tokens

let parse query =
  let l = Xunicode.classified_chars_of_utf8_string query in
  let l = ENIAMtokens.tokenize l in
  let l = ENIAMpatterns.normalize_tokens [] l in
  let l = ENIAMpatterns.find_replacement_patterns l in
  let l = ENIAMpatterns.remove_spaces [] l in
Wojciech Jaworski authored
35
  let l = ENIAMpatterns.manage_query_boundaries l in
Wojciech Jaworski authored
36
  let l = ENIAMpatterns.find_abr_patterns ENIAMacronyms.abr_patterns l in
Wojciech Jaworski authored
37
  (* let l = ENIAMpatterns.find_abr_patterns ENIAMacronyms.query_patterns l in *)
Wojciech Jaworski authored
38
39
  let l = ENIAMpatterns.normalize_tokens [] l in
  l