|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
8 %{C++ |
|
9 // {ADF42751-1CEF-4ad2-AA8E-BCB849D8D31F} |
|
10 #define NS_SEMANTICUNITSCANNER_CID { 0xadf42751, 0x1cef, 0x4ad2, { 0xaa, 0x8e, 0xbc, 0xb8, 0x49, 0xd8, 0xd3, 0x1f}} |
|
11 #define NS_SEMANTICUNITSCANNER_CONTRACTID "@mozilla.org/intl/semanticunitscanner;1" |
|
12 %} |
|
13 |
|
14 /** |
|
15 * Provides a language independent way to break UNICODE |
|
16 * text into meaningful semantic units (e.g. words). |
|
17 */ |
|
18 [scriptable, uuid(9f620be4-e535-11d6-b254-00039310a47a)] |
|
19 interface nsISemanticUnitScanner : nsISupports { |
|
20 /** |
|
21 * start() |
|
22 * |
|
23 * Starts up the semantic unit scanner with an optional |
|
24 * character set, which acts as a hint to optimize the heuristics |
|
25 * used to determine the language(s) of the processed text. |
|
26 * |
|
27 * @param characterSet the character set the text was originally |
|
28 * encoded in (can be NULL) |
|
29 */ |
|
30 void start(in string characterSet); |
|
31 |
|
32 /** |
|
33 * next() |
|
34 * Get the begin / end offset of the next unit in the current text |
|
35 * |
|
36 * @param text the text to be scanned |
|
37 * @param length the number of characters in the text to be processed |
|
38 * @param pos the current position |
|
39 * @param isLastBuffer, the buffer is the last one |
|
40 * @param begin the begin offset of the next unit |
|
41 * @param begin the end offset of the next unit |
|
42 * @return has more unit in the current text |
|
43 */ |
|
44 boolean next(in wstring text, in long length, in long pos, |
|
45 in boolean isLastBuffer, |
|
46 out long begin, out long end ); |
|
47 |
|
48 }; |