lucio commited on
Commit
9f8850a
1 Parent(s): b3113ac

rm kenlm binaries

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. kenlm/.github/workflows/mac.yml +0 -30
  2. kenlm/.github/workflows/ubuntu.yml +0 -27
  3. kenlm/.github/workflows/windows.yml +0 -25
  4. kenlm/.gitignore +0 -21
  5. kenlm/BUILDING +0 -21
  6. kenlm/CMakeLists.txt +0 -113
  7. kenlm/COPYING +0 -502
  8. kenlm/COPYING.3 +0 -674
  9. kenlm/COPYING.LESSER.3 +0 -165
  10. kenlm/Doxyfile +0 -1519
  11. kenlm/GIT_REVISION +0 -1
  12. kenlm/LICENSE +0 -25
  13. kenlm/MANIFEST.in +0 -9
  14. kenlm/README.md +0 -102
  15. kenlm/clean_query_only.sh +0 -2
  16. kenlm/cmake/KenLMFunctions.cmake +0 -81
  17. kenlm/cmake/modules/FindEigen3.cmake +0 -90
  18. kenlm/compile_query_only.sh +0 -34
  19. kenlm/include/lm/bhiksha.hh +0 -123
  20. kenlm/include/lm/binary_format.hh +0 -106
  21. kenlm/include/lm/blank.hh +0 -43
  22. kenlm/include/lm/builder/adjust_counts.hh +0 -72
  23. kenlm/include/lm/builder/corpus_count.hh +0 -53
  24. kenlm/include/lm/builder/discount.hh +0 -26
  25. kenlm/include/lm/builder/hash_gamma.hh +0 -19
  26. kenlm/include/lm/builder/header_info.hh +0 -24
  27. kenlm/include/lm/builder/initial_probabilities.hh +0 -42
  28. kenlm/include/lm/builder/interpolate.hh +0 -34
  29. kenlm/include/lm/builder/joint_order.hh +0 -67
  30. kenlm/include/lm/builder/ngram.hh +0 -109
  31. kenlm/include/lm/builder/ngram_stream.hh +0 -58
  32. kenlm/include/lm/builder/output.hh +0 -89
  33. kenlm/include/lm/builder/pipeline.hh +0 -74
  34. kenlm/include/lm/builder/print.hh +0 -115
  35. kenlm/include/lm/builder/sort.hh +0 -244
  36. kenlm/include/lm/config.hh +0 -124
  37. kenlm/include/lm/enumerate_vocab.hh +0 -28
  38. kenlm/include/lm/facade.hh +0 -73
  39. kenlm/include/lm/filter/arpa_io.hh +0 -114
  40. kenlm/include/lm/filter/count_io.hh +0 -89
  41. kenlm/include/lm/filter/format.hh +0 -250
  42. kenlm/include/lm/filter/phrase.hh +0 -168
  43. kenlm/include/lm/filter/thread.hh +0 -167
  44. kenlm/include/lm/filter/vocab.hh +0 -133
  45. kenlm/include/lm/filter/wrapper.hh +0 -56
  46. kenlm/include/lm/interpolate/arpa_to_stream.hh +0 -38
  47. kenlm/include/lm/left.hh +0 -216
  48. kenlm/include/lm/lm_exception.hh +0 -50
  49. kenlm/include/lm/max_order.hh +0 -13
  50. kenlm/include/lm/model.hh +0 -156
kenlm/.github/workflows/mac.yml DELETED
@@ -1,30 +0,0 @@
1
- name: Mac
2
-
3
- on:
4
- push:
5
- branches: master
6
- pull_request:
7
- branches: master
8
-
9
- jobs:
10
- build:
11
- runs-on: macOS-latest
12
-
13
- steps:
14
- - uses: actions/checkout@v2
15
- - name: Install Boost
16
- run: |
17
- brew install boost
18
- brew install libomp
19
- brew install eigen
20
- - name: cmake
21
- run: |
22
- cmake -E make_directory build
23
- cd build
24
- cmake ..
25
- - name: Compile
26
- working-directory: build
27
- run: cmake --build . -j2
28
- - name: Test
29
- working-directory: build
30
- run: ctest -j2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/.github/workflows/ubuntu.yml DELETED
@@ -1,27 +0,0 @@
1
- name: Ubuntu
2
-
3
- on:
4
- push:
5
- branches: [master]
6
- pull_request:
7
- branches: [master]
8
-
9
- jobs:
10
- build:
11
- runs-on: ubuntu-latest
12
-
13
- steps:
14
- - uses: actions/checkout@v2
15
- - name: dependencies
16
- run: sudo apt-get install -y build-essential libboost-all-dev cmake zlib1g-dev libbz2-dev liblzma-dev
17
- - name: cmake
18
- run: |
19
- cmake -E make_directory build
20
- cd build
21
- cmake -DCOMPILE_TESTS=ON ..
22
- - name: Compile
23
- working-directory: build
24
- run: cmake --build . -j2
25
- - name: Test
26
- working-directory: build
27
- run: ctest -j2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/.github/workflows/windows.yml DELETED
@@ -1,25 +0,0 @@
1
- name: Windows
2
-
3
- on:
4
- push:
5
- branches: [master]
6
- pull_request:
7
- branches: [master]
8
-
9
- jobs:
10
- build:
11
- runs-on: windows-latest
12
-
13
- steps:
14
- - uses: actions/checkout@v2
15
- - name: cmake
16
- run: |
17
- cmake -E make_directory build
18
- cd build
19
- cmake -DBOOST_ROOT="${env:BOOST_ROOT_1_72_0}" ..
20
- - name: Compile
21
- working-directory: build
22
- run: cmake --build . -j2
23
- - name: Test
24
- working-directory: build
25
- run: ctest -j2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- util/file_piece.cc.gz
2
- *.swp
3
- *.o
4
- doc/
5
- build/
6
- /bin
7
- /lib
8
- /tests
9
- ._*
10
- windows/Win32
11
- windows/x64
12
- windows/*.user
13
- windows/*.sdf
14
- windows/*.opensdf
15
- windows/*.suo
16
- CMakeFiles
17
- cmake_install.cmake
18
- CMakeCache.txt
19
- CTestTestfile.cmake
20
- DartConfiguration.tcl
21
- Makefile
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/BUILDING DELETED
@@ -1,21 +0,0 @@
1
- KenLM has switched to cmake
2
- cmake .
3
- make -j 4
4
- But they recommend building out of tree
5
- mkdir -p build && cd build
6
- cmake ..
7
- make -j 4
8
-
9
- If you only want the query code and do not care about compression (.gz, .bz2, and .xz):
10
- ./compile_query_only.sh
11
-
12
- Windows:
13
- The windows directory has visual studio files. Note that you need to compile
14
- the kenlm project before build_binary and ngram_query projects.
15
-
16
- OSX:
17
- Missing dependencies can be remedied with brew.
18
- brew install cmake boost eigen
19
-
20
- Debian/Ubuntu:
21
- sudo apt install build-essential cmake libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-test-dev libeigen3-dev zlib1g-dev libbz2-dev liblzma-dev
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/CMakeLists.txt DELETED
@@ -1,113 +0,0 @@
1
- cmake_minimum_required(VERSION 3.1)
2
-
3
- if (WIN32)
4
- set(Boost_USE_STATIC_LIBS OFF)
5
- # The auto-linking feature has problems with USE_STATIC_LIBS off, so we use
6
- # BOOST_ALL_NO_LIB to turn it off.
7
- # Several boost libraries headers aren't configured correctly if
8
- # USE_STATIC_LIBS is off, so we explicitly say they are dynamic with the
9
- # remaining definitions.
10
- add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_IOSTREAMS_DYN_LINK -DBOOST_THREAD_DYN_LINK)
11
- endif( )
12
-
13
- # Define a single cmake project
14
- project(kenlm)
15
-
16
- option(FORCE_STATIC "Build static executables" OFF)
17
- option(COMPILE_TESTS "Compile tests" OFF)
18
- option(ENABLE_PYTHON "Build Python bindings" OFF)
19
- # Eigen3 less than 3.1.0 has a race condition: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=466
20
- find_package(Eigen3 3.1.0 CONFIG)
21
- include(CMakeDependentOption)
22
- cmake_dependent_option(ENABLE_INTERPOLATE "Build interpolation program (depends on Eigen3)" ON "EIGEN3_FOUND AND NOT WIN32" OFF)
23
-
24
- if (FORCE_STATIC)
25
- #presumably overkill, is there a better way?
26
- #http://cmake.3232098.n2.nabble.com/Howto-compile-static-executable-td5580269.html
27
- set(Boost_USE_STATIC_LIBS ON)
28
- set_property(GLOBAL PROPERTY LINK_SEARCH_START_STATIC ON)
29
- set_property(GLOBAL PROPERTY LINK_SEARCH_END_STATIC ON)
30
- set(BUILD_SHARED_LIBRARIES OFF)
31
- if (MSVC)
32
- set(flag_vars
33
- CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
34
- CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
35
- CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
36
- CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
37
- foreach(flag_var ${flag_vars})
38
- if(${flag_var} MATCHES "/MD")
39
- string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
40
- endif(${flag_var} MATCHES "/MD")
41
- endforeach(flag_var)
42
- else (MSVC)
43
- if (NOT CMAKE_C_COMPILER_ID MATCHES ".*Clang")
44
- set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
45
- endif ()
46
- set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
47
- endif ()
48
- #Annoyingly the exectuables say "File not found" unless these are set
49
- set(CMAKE_EXE_LINK_DYNAMIC_C_FLAGS)
50
- set(CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS)
51
- set(CMAKE_SHARED_LIBRARY_C_FLAGS)
52
- set(CMAKE_SHARED_LIBRARY_CXX_FLAGS)
53
- set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)
54
- set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
55
- endif ()
56
-
57
- # Compile all executables into bin/
58
- set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
59
-
60
- # Compile all libraries into lib/
61
- set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
62
-
63
- if (NOT CMAKE_BUILD_TYPE)
64
- set(CMAKE_BUILD_TYPE Release)
65
- endif()
66
-
67
- if (COMPILE_TESTS)
68
- # Tell cmake that we want unit tests to be compiled
69
- include(CTest)
70
- enable_testing()
71
- endif()
72
-
73
- # Add our CMake helper functions
74
- include(cmake/KenLMFunctions.cmake)
75
-
76
- if(MSVC)
77
- set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} /w34716")
78
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w34716")
79
- endif()
80
-
81
- # And our helper modules
82
- list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
83
-
84
- # We need boost
85
- find_package(Boost 1.41.0 REQUIRED COMPONENTS
86
- program_options
87
- system
88
- thread
89
- unit_test_framework
90
- )
91
-
92
- # Define where include files live
93
- include_directories(
94
- ${PROJECT_SOURCE_DIR}
95
- ${Boost_INCLUDE_DIRS}
96
- )
97
-
98
- set(THREADS_PREFER_PTHREAD_FLAG ON)
99
- find_package(Threads REQUIRED)
100
-
101
- # Process subdirectories
102
- add_subdirectory(util)
103
- add_subdirectory(lm)
104
-
105
- foreach(SUBDIR IN ITEMS util util/double-conversion util/stream lm lm/builder lm/common lm/filter lm/interpolate)
106
- file(GLOB HEADERS ${CMAKE_CURRENT_LIST_DIR}/${SUBDIR}/*.h ${CMAKE_CURRENT_LIST_DIR}/${SUBDIR}/*.hh)
107
- install(FILES ${HEADERS} DESTINATION include/kenlm/${SUBDIR})
108
- endforeach(SUBDIR)
109
-
110
- if(ENABLE_PYTHON)
111
- add_subdirectory(python)
112
- endif()
113
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/COPYING DELETED
@@ -1,502 +0,0 @@
1
- GNU LESSER GENERAL PUBLIC LICENSE
2
- Version 2.1, February 1999
3
-
4
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
5
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
- Everyone is permitted to copy and distribute verbatim copies
7
- of this license document, but changing it is not allowed.
8
-
9
- [This is the first released version of the Lesser GPL. It also counts
10
- as the successor of the GNU Library Public License, version 2, hence
11
- the version number 2.1.]
12
-
13
- Preamble
14
-
15
- The licenses for most software are designed to take away your
16
- freedom to share and change it. By contrast, the GNU General Public
17
- Licenses are intended to guarantee your freedom to share and change
18
- free software--to make sure the software is free for all its users.
19
-
20
- This license, the Lesser General Public License, applies to some
21
- specially designated software packages--typically libraries--of the
22
- Free Software Foundation and other authors who decide to use it. You
23
- can use it too, but we suggest you first think carefully about whether
24
- this license or the ordinary General Public License is the better
25
- strategy to use in any particular case, based on the explanations below.
26
-
27
- When we speak of free software, we are referring to freedom of use,
28
- not price. Our General Public Licenses are designed to make sure that
29
- you have the freedom to distribute copies of free software (and charge
30
- for this service if you wish); that you receive source code or can get
31
- it if you want it; that you can change the software and use pieces of
32
- it in new free programs; and that you are informed that you can do
33
- these things.
34
-
35
- To protect your rights, we need to make restrictions that forbid
36
- distributors to deny you these rights or to ask you to surrender these
37
- rights. These restrictions translate to certain responsibilities for
38
- you if you distribute copies of the library or if you modify it.
39
-
40
- For example, if you distribute copies of the library, whether gratis
41
- or for a fee, you must give the recipients all the rights that we gave
42
- you. You must make sure that they, too, receive or can get the source
43
- code. If you link other code with the library, you must provide
44
- complete object files to the recipients, so that they can relink them
45
- with the library after making changes to the library and recompiling
46
- it. And you must show them these terms so they know their rights.
47
-
48
- We protect your rights with a two-step method: (1) we copyright the
49
- library, and (2) we offer you this license, which gives you legal
50
- permission to copy, distribute and/or modify the library.
51
-
52
- To protect each distributor, we want to make it very clear that
53
- there is no warranty for the free library. Also, if the library is
54
- modified by someone else and passed on, the recipients should know
55
- that what they have is not the original version, so that the original
56
- author's reputation will not be affected by problems that might be
57
- introduced by others.
58
-
59
- Finally, software patents pose a constant threat to the existence of
60
- any free program. We wish to make sure that a company cannot
61
- effectively restrict the users of a free program by obtaining a
62
- restrictive license from a patent holder. Therefore, we insist that
63
- any patent license obtained for a version of the library must be
64
- consistent with the full freedom of use specified in this license.
65
-
66
- Most GNU software, including some libraries, is covered by the
67
- ordinary GNU General Public License. This license, the GNU Lesser
68
- General Public License, applies to certain designated libraries, and
69
- is quite different from the ordinary General Public License. We use
70
- this license for certain libraries in order to permit linking those
71
- libraries into non-free programs.
72
-
73
- When a program is linked with a library, whether statically or using
74
- a shared library, the combination of the two is legally speaking a
75
- combined work, a derivative of the original library. The ordinary
76
- General Public License therefore permits such linking only if the
77
- entire combination fits its criteria of freedom. The Lesser General
78
- Public License permits more lax criteria for linking other code with
79
- the library.
80
-
81
- We call this license the "Lesser" General Public License because it
82
- does Less to protect the user's freedom than the ordinary General
83
- Public License. It also provides other free software developers Less
84
- of an advantage over competing non-free programs. These disadvantages
85
- are the reason we use the ordinary General Public License for many
86
- libraries. However, the Lesser license provides advantages in certain
87
- special circumstances.
88
-
89
- For example, on rare occasions, there may be a special need to
90
- encourage the widest possible use of a certain library, so that it becomes
91
- a de-facto standard. To achieve this, non-free programs must be
92
- allowed to use the library. A more frequent case is that a free
93
- library does the same job as widely used non-free libraries. In this
94
- case, there is little to gain by limiting the free library to free
95
- software only, so we use the Lesser General Public License.
96
-
97
- In other cases, permission to use a particular library in non-free
98
- programs enables a greater number of people to use a large body of
99
- free software. For example, permission to use the GNU C Library in
100
- non-free programs enables many more people to use the whole GNU
101
- operating system, as well as its variant, the GNU/Linux operating
102
- system.
103
-
104
- Although the Lesser General Public License is Less protective of the
105
- users' freedom, it does ensure that the user of a program that is
106
- linked with the Library has the freedom and the wherewithal to run
107
- that program using a modified version of the Library.
108
-
109
- The precise terms and conditions for copying, distribution and
110
- modification follow. Pay close attention to the difference between a
111
- "work based on the library" and a "work that uses the library". The
112
- former contains code derived from the library, whereas the latter must
113
- be combined with the library in order to run.
114
-
115
- GNU LESSER GENERAL PUBLIC LICENSE
116
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
117
-
118
- 0. This License Agreement applies to any software library or other
119
- program which contains a notice placed by the copyright holder or
120
- other authorized party saying it may be distributed under the terms of
121
- this Lesser General Public License (also called "this License").
122
- Each licensee is addressed as "you".
123
-
124
- A "library" means a collection of software functions and/or data
125
- prepared so as to be conveniently linked with application programs
126
- (which use some of those functions and data) to form executables.
127
-
128
- The "Library", below, refers to any such software library or work
129
- which has been distributed under these terms. A "work based on the
130
- Library" means either the Library or any derivative work under
131
- copyright law: that is to say, a work containing the Library or a
132
- portion of it, either verbatim or with modifications and/or translated
133
- straightforwardly into another language. (Hereinafter, translation is
134
- included without limitation in the term "modification".)
135
-
136
- "Source code" for a work means the preferred form of the work for
137
- making modifications to it. For a library, complete source code means
138
- all the source code for all modules it contains, plus any associated
139
- interface definition files, plus the scripts used to control compilation
140
- and installation of the library.
141
-
142
- Activities other than copying, distribution and modification are not
143
- covered by this License; they are outside its scope. The act of
144
- running a program using the Library is not restricted, and output from
145
- such a program is covered only if its contents constitute a work based
146
- on the Library (independent of the use of the Library in a tool for
147
- writing it). Whether that is true depends on what the Library does
148
- and what the program that uses the Library does.
149
-
150
- 1. You may copy and distribute verbatim copies of the Library's
151
- complete source code as you receive it, in any medium, provided that
152
- you conspicuously and appropriately publish on each copy an
153
- appropriate copyright notice and disclaimer of warranty; keep intact
154
- all the notices that refer to this License and to the absence of any
155
- warranty; and distribute a copy of this License along with the
156
- Library.
157
-
158
- You may charge a fee for the physical act of transferring a copy,
159
- and you may at your option offer warranty protection in exchange for a
160
- fee.
161
-
162
- 2. You may modify your copy or copies of the Library or any portion
163
- of it, thus forming a work based on the Library, and copy and
164
- distribute such modifications or work under the terms of Section 1
165
- above, provided that you also meet all of these conditions:
166
-
167
- a) The modified work must itself be a software library.
168
-
169
- b) You must cause the files modified to carry prominent notices
170
- stating that you changed the files and the date of any change.
171
-
172
- c) You must cause the whole of the work to be licensed at no
173
- charge to all third parties under the terms of this License.
174
-
175
- d) If a facility in the modified Library refers to a function or a
176
- table of data to be supplied by an application program that uses
177
- the facility, other than as an argument passed when the facility
178
- is invoked, then you must make a good faith effort to ensure that,
179
- in the event an application does not supply such function or
180
- table, the facility still operates, and performs whatever part of
181
- its purpose remains meaningful.
182
-
183
- (For example, a function in a library to compute square roots has
184
- a purpose that is entirely well-defined independent of the
185
- application. Therefore, Subsection 2d requires that any
186
- application-supplied function or table used by this function must
187
- be optional: if the application does not supply it, the square
188
- root function must still compute square roots.)
189
-
190
- These requirements apply to the modified work as a whole. If
191
- identifiable sections of that work are not derived from the Library,
192
- and can be reasonably considered independent and separate works in
193
- themselves, then this License, and its terms, do not apply to those
194
- sections when you distribute them as separate works. But when you
195
- distribute the same sections as part of a whole which is a work based
196
- on the Library, the distribution of the whole must be on the terms of
197
- this License, whose permissions for other licensees extend to the
198
- entire whole, and thus to each and every part regardless of who wrote
199
- it.
200
-
201
- Thus, it is not the intent of this section to claim rights or contest
202
- your rights to work written entirely by you; rather, the intent is to
203
- exercise the right to control the distribution of derivative or
204
- collective works based on the Library.
205
-
206
- In addition, mere aggregation of another work not based on the Library
207
- with the Library (or with a work based on the Library) on a volume of
208
- a storage or distribution medium does not bring the other work under
209
- the scope of this License.
210
-
211
- 3. You may opt to apply the terms of the ordinary GNU General Public
212
- License instead of this License to a given copy of the Library. To do
213
- this, you must alter all the notices that refer to this License, so
214
- that they refer to the ordinary GNU General Public License, version 2,
215
- instead of to this License. (If a newer version than version 2 of the
216
- ordinary GNU General Public License has appeared, then you can specify
217
- that version instead if you wish.) Do not make any other change in
218
- these notices.
219
-
220
- Once this change is made in a given copy, it is irreversible for
221
- that copy, so the ordinary GNU General Public License applies to all
222
- subsequent copies and derivative works made from that copy.
223
-
224
- This option is useful when you wish to copy part of the code of
225
- the Library into a program that is not a library.
226
-
227
- 4. You may copy and distribute the Library (or a portion or
228
- derivative of it, under Section 2) in object code or executable form
229
- under the terms of Sections 1 and 2 above provided that you accompany
230
- it with the complete corresponding machine-readable source code, which
231
- must be distributed under the terms of Sections 1 and 2 above on a
232
- medium customarily used for software interchange.
233
-
234
- If distribution of object code is made by offering access to copy
235
- from a designated place, then offering equivalent access to copy the
236
- source code from the same place satisfies the requirement to
237
- distribute the source code, even though third parties are not
238
- compelled to copy the source along with the object code.
239
-
240
- 5. A program that contains no derivative of any portion of the
241
- Library, but is designed to work with the Library by being compiled or
242
- linked with it, is called a "work that uses the Library". Such a
243
- work, in isolation, is not a derivative work of the Library, and
244
- therefore falls outside the scope of this License.
245
-
246
- However, linking a "work that uses the Library" with the Library
247
- creates an executable that is a derivative of the Library (because it
248
- contains portions of the Library), rather than a "work that uses the
249
- library". The executable is therefore covered by this License.
250
- Section 6 states terms for distribution of such executables.
251
-
252
- When a "work that uses the Library" uses material from a header file
253
- that is part of the Library, the object code for the work may be a
254
- derivative work of the Library even though the source code is not.
255
- Whether this is true is especially significant if the work can be
256
- linked without the Library, or if the work is itself a library. The
257
- threshold for this to be true is not precisely defined by law.
258
-
259
- If such an object file uses only numerical parameters, data
260
- structure layouts and accessors, and small macros and small inline
261
- functions (ten lines or less in length), then the use of the object
262
- file is unrestricted, regardless of whether it is legally a derivative
263
- work. (Executables containing this object code plus portions of the
264
- Library will still fall under Section 6.)
265
-
266
- Otherwise, if the work is a derivative of the Library, you may
267
- distribute the object code for the work under the terms of Section 6.
268
- Any executables containing that work also fall under Section 6,
269
- whether or not they are linked directly with the Library itself.
270
-
271
- 6. As an exception to the Sections above, you may also combine or
272
- link a "work that uses the Library" with the Library to produce a
273
- work containing portions of the Library, and distribute that work
274
- under terms of your choice, provided that the terms permit
275
- modification of the work for the customer's own use and reverse
276
- engineering for debugging such modifications.
277
-
278
- You must give prominent notice with each copy of the work that the
279
- Library is used in it and that the Library and its use are covered by
280
- this License. You must supply a copy of this License. If the work
281
- during execution displays copyright notices, you must include the
282
- copyright notice for the Library among them, as well as a reference
283
- directing the user to the copy of this License. Also, you must do one
284
- of these things:
285
-
286
- a) Accompany the work with the complete corresponding
287
- machine-readable source code for the Library including whatever
288
- changes were used in the work (which must be distributed under
289
- Sections 1 and 2 above); and, if the work is an executable linked
290
- with the Library, with the complete machine-readable "work that
291
- uses the Library", as object code and/or source code, so that the
292
- user can modify the Library and then relink to produce a modified
293
- executable containing the modified Library. (It is understood
294
- that the user who changes the contents of definitions files in the
295
- Library will not necessarily be able to recompile the application
296
- to use the modified definitions.)
297
-
298
- b) Use a suitable shared library mechanism for linking with the
299
- Library. A suitable mechanism is one that (1) uses at run time a
300
- copy of the library already present on the user's computer system,
301
- rather than copying library functions into the executable, and (2)
302
- will operate properly with a modified version of the library, if
303
- the user installs one, as long as the modified version is
304
- interface-compatible with the version that the work was made with.
305
-
306
- c) Accompany the work with a written offer, valid for at
307
- least three years, to give the same user the materials
308
- specified in Subsection 6a, above, for a charge no more
309
- than the cost of performing this distribution.
310
-
311
- d) If distribution of the work is made by offering access to copy
312
- from a designated place, offer equivalent access to copy the above
313
- specified materials from the same place.
314
-
315
- e) Verify that the user has already received a copy of these
316
- materials or that you have already sent this user a copy.
317
-
318
- For an executable, the required form of the "work that uses the
319
- Library" must include any data and utility programs needed for
320
- reproducing the executable from it. However, as a special exception,
321
- the materials to be distributed need not include anything that is
322
- normally distributed (in either source or binary form) with the major
323
- components (compiler, kernel, and so on) of the operating system on
324
- which the executable runs, unless that component itself accompanies
325
- the executable.
326
-
327
- It may happen that this requirement contradicts the license
328
- restrictions of other proprietary libraries that do not normally
329
- accompany the operating system. Such a contradiction means you cannot
330
- use both them and the Library together in an executable that you
331
- distribute.
332
-
333
- 7. You may place library facilities that are a work based on the
334
- Library side-by-side in a single library together with other library
335
- facilities not covered by this License, and distribute such a combined
336
- library, provided that the separate distribution of the work based on
337
- the Library and of the other library facilities is otherwise
338
- permitted, and provided that you do these two things:
339
-
340
- a) Accompany the combined library with a copy of the same work
341
- based on the Library, uncombined with any other library
342
- facilities. This must be distributed under the terms of the
343
- Sections above.
344
-
345
- b) Give prominent notice with the combined library of the fact
346
- that part of it is a work based on the Library, and explaining
347
- where to find the accompanying uncombined form of the same work.
348
-
349
- 8. You may not copy, modify, sublicense, link with, or distribute
350
- the Library except as expressly provided under this License. Any
351
- attempt otherwise to copy, modify, sublicense, link with, or
352
- distribute the Library is void, and will automatically terminate your
353
- rights under this License. However, parties who have received copies,
354
- or rights, from you under this License will not have their licenses
355
- terminated so long as such parties remain in full compliance.
356
-
357
- 9. You are not required to accept this License, since you have not
358
- signed it. However, nothing else grants you permission to modify or
359
- distribute the Library or its derivative works. These actions are
360
- prohibited by law if you do not accept this License. Therefore, by
361
- modifying or distributing the Library (or any work based on the
362
- Library), you indicate your acceptance of this License to do so, and
363
- all its terms and conditions for copying, distributing or modifying
364
- the Library or works based on it.
365
-
366
- 10. Each time you redistribute the Library (or any work based on the
367
- Library), the recipient automatically receives a license from the
368
- original licensor to copy, distribute, link with or modify the Library
369
- subject to these terms and conditions. You may not impose any further
370
- restrictions on the recipients' exercise of the rights granted herein.
371
- You are not responsible for enforcing compliance by third parties with
372
- this License.
373
-
374
- 11. If, as a consequence of a court judgment or allegation of patent
375
- infringement or for any other reason (not limited to patent issues),
376
- conditions are imposed on you (whether by court order, agreement or
377
- otherwise) that contradict the conditions of this License, they do not
378
- excuse you from the conditions of this License. If you cannot
379
- distribute so as to satisfy simultaneously your obligations under this
380
- License and any other pertinent obligations, then as a consequence you
381
- may not distribute the Library at all. For example, if a patent
382
- license would not permit royalty-free redistribution of the Library by
383
- all those who receive copies directly or indirectly through you, then
384
- the only way you could satisfy both it and this License would be to
385
- refrain entirely from distribution of the Library.
386
-
387
- If any portion of this section is held invalid or unenforceable under any
388
- particular circumstance, the balance of the section is intended to apply,
389
- and the section as a whole is intended to apply in other circumstances.
390
-
391
- It is not the purpose of this section to induce you to infringe any
392
- patents or other property right claims or to contest validity of any
393
- such claims; this section has the sole purpose of protecting the
394
- integrity of the free software distribution system which is
395
- implemented by public license practices. Many people have made
396
- generous contributions to the wide range of software distributed
397
- through that system in reliance on consistent application of that
398
- system; it is up to the author/donor to decide if he or she is willing
399
- to distribute software through any other system and a licensee cannot
400
- impose that choice.
401
-
402
- This section is intended to make thoroughly clear what is believed to
403
- be a consequence of the rest of this License.
404
-
405
- 12. If the distribution and/or use of the Library is restricted in
406
- certain countries either by patents or by copyrighted interfaces, the
407
- original copyright holder who places the Library under this License may add
408
- an explicit geographical distribution limitation excluding those countries,
409
- so that distribution is permitted only in or among countries not thus
410
- excluded. In such case, this License incorporates the limitation as if
411
- written in the body of this License.
412
-
413
- 13. The Free Software Foundation may publish revised and/or new
414
- versions of the Lesser General Public License from time to time.
415
- Such new versions will be similar in spirit to the present version,
416
- but may differ in detail to address new problems or concerns.
417
-
418
- Each version is given a distinguishing version number. If the Library
419
- specifies a version number of this License which applies to it and
420
- "any later version", you have the option of following the terms and
421
- conditions either of that version or of any later version published by
422
- the Free Software Foundation. If the Library does not specify a
423
- license version number, you may choose any version ever published by
424
- the Free Software Foundation.
425
-
426
- 14. If you wish to incorporate parts of the Library into other free
427
- programs whose distribution conditions are incompatible with these,
428
- write to the author to ask for permission. For software which is
429
- copyrighted by the Free Software Foundation, write to the Free
430
- Software Foundation; we sometimes make exceptions for this. Our
431
- decision will be guided by the two goals of preserving the free status
432
- of all derivatives of our free software and of promoting the sharing
433
- and reuse of software generally.
434
-
435
- NO WARRANTY
436
-
437
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
438
- WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
439
- EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
440
- OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
441
- KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
442
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
443
- PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
444
- LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
445
- THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
446
-
447
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
448
- WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
449
- AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
450
- FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
451
- CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
452
- LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
453
- RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
454
- FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
455
- SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
456
- DAMAGES.
457
-
458
- END OF TERMS AND CONDITIONS
459
-
460
- How to Apply These Terms to Your New Libraries
461
-
462
- If you develop a new library, and you want it to be of the greatest
463
- possible use to the public, we recommend making it free software that
464
- everyone can redistribute and change. You can do so by permitting
465
- redistribution under these terms (or, alternatively, under the terms of the
466
- ordinary General Public License).
467
-
468
- To apply these terms, attach the following notices to the library. It is
469
- safest to attach them to the start of each source file to most effectively
470
- convey the exclusion of warranty; and each file should have at least the
471
- "copyright" line and a pointer to where the full notice is found.
472
-
473
- <one line to give the library's name and a brief idea of what it does.>
474
- Copyright (C) <year> <name of author>
475
-
476
- This library is free software; you can redistribute it and/or
477
- modify it under the terms of the GNU Lesser General Public
478
- License as published by the Free Software Foundation; either
479
- version 2.1 of the License, or (at your option) any later version.
480
-
481
- This library is distributed in the hope that it will be useful,
482
- but WITHOUT ANY WARRANTY; without even the implied warranty of
483
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
484
- Lesser General Public License for more details.
485
-
486
- You should have received a copy of the GNU Lesser General Public
487
- License along with this library; if not, write to the Free Software
488
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
489
-
490
- Also add information on how to contact you by electronic and paper mail.
491
-
492
- You should also get your employer (if you work as a programmer) or your
493
- school, if any, to sign a "copyright disclaimer" for the library, if
494
- necessary. Here is a sample; alter the names:
495
-
496
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
497
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
498
-
499
- <signature of Ty Coon>, 1 April 1990
500
- Ty Coon, President of Vice
501
-
502
- That's all there is to it!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/COPYING.3 DELETED
@@ -1,674 +0,0 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
- Preamble
9
-
10
- The GNU General Public License is a free, copyleft license for
11
- software and other kinds of works.
12
-
13
- The licenses for most software and other practical works are designed
14
- to take away your freedom to share and change the works. By contrast,
15
- the GNU General Public License is intended to guarantee your freedom to
16
- share and change all versions of a program--to make sure it remains free
17
- software for all its users. We, the Free Software Foundation, use the
18
- GNU General Public License for most of our software; it applies also to
19
- any other work released this way by its authors. You can apply it to
20
- your programs, too.
21
-
22
- When we speak of free software, we are referring to freedom, not
23
- price. Our General Public Licenses are designed to make sure that you
24
- have the freedom to distribute copies of free software (and charge for
25
- them if you wish), that you receive source code or can get it if you
26
- want it, that you can change the software or use pieces of it in new
27
- free programs, and that you know you can do these things.
28
-
29
- To protect your rights, we need to prevent others from denying you
30
- these rights or asking you to surrender the rights. Therefore, you have
31
- certain responsibilities if you distribute copies of the software, or if
32
- you modify it: responsibilities to respect the freedom of others.
33
-
34
- For example, if you distribute copies of such a program, whether
35
- gratis or for a fee, you must pass on to the recipients the same
36
- freedoms that you received. You must make sure that they, too, receive
37
- or can get the source code. And you must show them these terms so they
38
- know their rights.
39
-
40
- Developers that use the GNU GPL protect your rights with two steps:
41
- (1) assert copyright on the software, and (2) offer you this License
42
- giving you legal permission to copy, distribute and/or modify it.
43
-
44
- For the developers' and authors' protection, the GPL clearly explains
45
- that there is no warranty for this free software. For both users' and
46
- authors' sake, the GPL requires that modified versions be marked as
47
- changed, so that their problems will not be attributed erroneously to
48
- authors of previous versions.
49
-
50
- Some devices are designed to deny users access to install or run
51
- modified versions of the software inside them, although the manufacturer
52
- can do so. This is fundamentally incompatible with the aim of
53
- protecting users' freedom to change the software. The systematic
54
- pattern of such abuse occurs in the area of products for individuals to
55
- use, which is precisely where it is most unacceptable. Therefore, we
56
- have designed this version of the GPL to prohibit the practice for those
57
- products. If such problems arise substantially in other domains, we
58
- stand ready to extend this provision to those domains in future versions
59
- of the GPL, as needed to protect the freedom of users.
60
-
61
- Finally, every program is threatened constantly by software patents.
62
- States should not allow patents to restrict development and use of
63
- software on general-purpose computers, but in those that do, we wish to
64
- avoid the special danger that patents applied to a free program could
65
- make it effectively proprietary. To prevent this, the GPL assures that
66
- patents cannot be used to render the program non-free.
67
-
68
- The precise terms and conditions for copying, distribution and
69
- modification follow.
70
-
71
- TERMS AND CONDITIONS
72
-
73
- 0. Definitions.
74
-
75
- "This License" refers to version 3 of the GNU General Public License.
76
-
77
- "Copyright" also means copyright-like laws that apply to other kinds of
78
- works, such as semiconductor masks.
79
-
80
- "The Program" refers to any copyrightable work licensed under this
81
- License. Each licensee is addressed as "you". "Licensees" and
82
- "recipients" may be individuals or organizations.
83
-
84
- To "modify" a work means to copy from or adapt all or part of the work
85
- in a fashion requiring copyright permission, other than the making of an
86
- exact copy. The resulting work is called a "modified version" of the
87
- earlier work or a work "based on" the earlier work.
88
-
89
- A "covered work" means either the unmodified Program or a work based
90
- on the Program.
91
-
92
- To "propagate" a work means to do anything with it that, without
93
- permission, would make you directly or secondarily liable for
94
- infringement under applicable copyright law, except executing it on a
95
- computer or modifying a private copy. Propagation includes copying,
96
- distribution (with or without modification), making available to the
97
- public, and in some countries other activities as well.
98
-
99
- To "convey" a work means any kind of propagation that enables other
100
- parties to make or receive copies. Mere interaction with a user through
101
- a computer network, with no transfer of a copy, is not conveying.
102
-
103
- An interactive user interface displays "Appropriate Legal Notices"
104
- to the extent that it includes a convenient and prominently visible
105
- feature that (1) displays an appropriate copyright notice, and (2)
106
- tells the user that there is no warranty for the work (except to the
107
- extent that warranties are provided), that licensees may convey the
108
- work under this License, and how to view a copy of this License. If
109
- the interface presents a list of user commands or options, such as a
110
- menu, a prominent item in the list meets this criterion.
111
-
112
- 1. Source Code.
113
-
114
- The "source code" for a work means the preferred form of the work
115
- for making modifications to it. "Object code" means any non-source
116
- form of a work.
117
-
118
- A "Standard Interface" means an interface that either is an official
119
- standard defined by a recognized standards body, or, in the case of
120
- interfaces specified for a particular programming language, one that
121
- is widely used among developers working in that language.
122
-
123
- The "System Libraries" of an executable work include anything, other
124
- than the work as a whole, that (a) is included in the normal form of
125
- packaging a Major Component, but which is not part of that Major
126
- Component, and (b) serves only to enable use of the work with that
127
- Major Component, or to implement a Standard Interface for which an
128
- implementation is available to the public in source code form. A
129
- "Major Component", in this context, means a major essential component
130
- (kernel, window system, and so on) of the specific operating system
131
- (if any) on which the executable work runs, or a compiler used to
132
- produce the work, or an object code interpreter used to run it.
133
-
134
- The "Corresponding Source" for a work in object code form means all
135
- the source code needed to generate, install, and (for an executable
136
- work) run the object code and to modify the work, including scripts to
137
- control those activities. However, it does not include the work's
138
- System Libraries, or general-purpose tools or generally available free
139
- programs which are used unmodified in performing those activities but
140
- which are not part of the work. For example, Corresponding Source
141
- includes interface definition files associated with source files for
142
- the work, and the source code for shared libraries and dynamically
143
- linked subprograms that the work is specifically designed to require,
144
- such as by intimate data communication or control flow between those
145
- subprograms and other parts of the work.
146
-
147
- The Corresponding Source need not include anything that users
148
- can regenerate automatically from other parts of the Corresponding
149
- Source.
150
-
151
- The Corresponding Source for a work in source code form is that
152
- same work.
153
-
154
- 2. Basic Permissions.
155
-
156
- All rights granted under this License are granted for the term of
157
- copyright on the Program, and are irrevocable provided the stated
158
- conditions are met. This License explicitly affirms your unlimited
159
- permission to run the unmodified Program. The output from running a
160
- covered work is covered by this License only if the output, given its
161
- content, constitutes a covered work. This License acknowledges your
162
- rights of fair use or other equivalent, as provided by copyright law.
163
-
164
- You may make, run and propagate covered works that you do not
165
- convey, without conditions so long as your license otherwise remains
166
- in force. You may convey covered works to others for the sole purpose
167
- of having them make modifications exclusively for you, or provide you
168
- with facilities for running those works, provided that you comply with
169
- the terms of this License in conveying all material for which you do
170
- not control copyright. Those thus making or running the covered works
171
- for you must do so exclusively on your behalf, under your direction
172
- and control, on terms that prohibit them from making any copies of
173
- your copyrighted material outside their relationship with you.
174
-
175
- Conveying under any other circumstances is permitted solely under
176
- the conditions stated below. Sublicensing is not allowed; section 10
177
- makes it unnecessary.
178
-
179
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
-
181
- No covered work shall be deemed part of an effective technological
182
- measure under any applicable law fulfilling obligations under article
183
- 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
- similar laws prohibiting or restricting circumvention of such
185
- measures.
186
-
187
- When you convey a covered work, you waive any legal power to forbid
188
- circumvention of technological measures to the extent such circumvention
189
- is effected by exercising rights under this License with respect to
190
- the covered work, and you disclaim any intention to limit operation or
191
- modification of the work as a means of enforcing, against the work's
192
- users, your or third parties' legal rights to forbid circumvention of
193
- technological measures.
194
-
195
- 4. Conveying Verbatim Copies.
196
-
197
- You may convey verbatim copies of the Program's source code as you
198
- receive it, in any medium, provided that you conspicuously and
199
- appropriately publish on each copy an appropriate copyright notice;
200
- keep intact all notices stating that this License and any
201
- non-permissive terms added in accord with section 7 apply to the code;
202
- keep intact all notices of the absence of any warranty; and give all
203
- recipients a copy of this License along with the Program.
204
-
205
- You may charge any price or no price for each copy that you convey,
206
- and you may offer support or warranty protection for a fee.
207
-
208
- 5. Conveying Modified Source Versions.
209
-
210
- You may convey a work based on the Program, or the modifications to
211
- produce it from the Program, in the form of source code under the
212
- terms of section 4, provided that you also meet all of these conditions:
213
-
214
- a) The work must carry prominent notices stating that you modified
215
- it, and giving a relevant date.
216
-
217
- b) The work must carry prominent notices stating that it is
218
- released under this License and any conditions added under section
219
- 7. This requirement modifies the requirement in section 4 to
220
- "keep intact all notices".
221
-
222
- c) You must license the entire work, as a whole, under this
223
- License to anyone who comes into possession of a copy. This
224
- License will therefore apply, along with any applicable section 7
225
- additional terms, to the whole of the work, and all its parts,
226
- regardless of how they are packaged. This License gives no
227
- permission to license the work in any other way, but it does not
228
- invalidate such permission if you have separately received it.
229
-
230
- d) If the work has interactive user interfaces, each must display
231
- Appropriate Legal Notices; however, if the Program has interactive
232
- interfaces that do not display Appropriate Legal Notices, your
233
- work need not make them do so.
234
-
235
- A compilation of a covered work with other separate and independent
236
- works, which are not by their nature extensions of the covered work,
237
- and which are not combined with it such as to form a larger program,
238
- in or on a volume of a storage or distribution medium, is called an
239
- "aggregate" if the compilation and its resulting copyright are not
240
- used to limit the access or legal rights of the compilation's users
241
- beyond what the individual works permit. Inclusion of a covered work
242
- in an aggregate does not cause this License to apply to the other
243
- parts of the aggregate.
244
-
245
- 6. Conveying Non-Source Forms.
246
-
247
- You may convey a covered work in object code form under the terms
248
- of sections 4 and 5, provided that you also convey the
249
- machine-readable Corresponding Source under the terms of this License,
250
- in one of these ways:
251
-
252
- a) Convey the object code in, or embodied in, a physical product
253
- (including a physical distribution medium), accompanied by the
254
- Corresponding Source fixed on a durable physical medium
255
- customarily used for software interchange.
256
-
257
- b) Convey the object code in, or embodied in, a physical product
258
- (including a physical distribution medium), accompanied by a
259
- written offer, valid for at least three years and valid for as
260
- long as you offer spare parts or customer support for that product
261
- model, to give anyone who possesses the object code either (1) a
262
- copy of the Corresponding Source for all the software in the
263
- product that is covered by this License, on a durable physical
264
- medium customarily used for software interchange, for a price no
265
- more than your reasonable cost of physically performing this
266
- conveying of source, or (2) access to copy the
267
- Corresponding Source from a network server at no charge.
268
-
269
- c) Convey individual copies of the object code with a copy of the
270
- written offer to provide the Corresponding Source. This
271
- alternative is allowed only occasionally and noncommercially, and
272
- only if you received the object code with such an offer, in accord
273
- with subsection 6b.
274
-
275
- d) Convey the object code by offering access from a designated
276
- place (gratis or for a charge), and offer equivalent access to the
277
- Corresponding Source in the same way through the same place at no
278
- further charge. You need not require recipients to copy the
279
- Corresponding Source along with the object code. If the place to
280
- copy the object code is a network server, the Corresponding Source
281
- may be on a different server (operated by you or a third party)
282
- that supports equivalent copying facilities, provided you maintain
283
- clear directions next to the object code saying where to find the
284
- Corresponding Source. Regardless of what server hosts the
285
- Corresponding Source, you remain obligated to ensure that it is
286
- available for as long as needed to satisfy these requirements.
287
-
288
- e) Convey the object code using peer-to-peer transmission, provided
289
- you inform other peers where the object code and Corresponding
290
- Source of the work are being offered to the general public at no
291
- charge under subsection 6d.
292
-
293
- A separable portion of the object code, whose source code is excluded
294
- from the Corresponding Source as a System Library, need not be
295
- included in conveying the object code work.
296
-
297
- A "User Product" is either (1) a "consumer product", which means any
298
- tangible personal property which is normally used for personal, family,
299
- or household purposes, or (2) anything designed or sold for incorporation
300
- into a dwelling. In determining whether a product is a consumer product,
301
- doubtful cases shall be resolved in favor of coverage. For a particular
302
- product received by a particular user, "normally used" refers to a
303
- typical or common use of that class of product, regardless of the status
304
- of the particular user or of the way in which the particular user
305
- actually uses, or expects or is expected to use, the product. A product
306
- is a consumer product regardless of whether the product has substantial
307
- commercial, industrial or non-consumer uses, unless such uses represent
308
- the only significant mode of use of the product.
309
-
310
- "Installation Information" for a User Product means any methods,
311
- procedures, authorization keys, or other information required to install
312
- and execute modified versions of a covered work in that User Product from
313
- a modified version of its Corresponding Source. The information must
314
- suffice to ensure that the continued functioning of the modified object
315
- code is in no case prevented or interfered with solely because
316
- modification has been made.
317
-
318
- If you convey an object code work under this section in, or with, or
319
- specifically for use in, a User Product, and the conveying occurs as
320
- part of a transaction in which the right of possession and use of the
321
- User Product is transferred to the recipient in perpetuity or for a
322
- fixed term (regardless of how the transaction is characterized), the
323
- Corresponding Source conveyed under this section must be accompanied
324
- by the Installation Information. But this requirement does not apply
325
- if neither you nor any third party retains the ability to install
326
- modified object code on the User Product (for example, the work has
327
- been installed in ROM).
328
-
329
- The requirement to provide Installation Information does not include a
330
- requirement to continue to provide support service, warranty, or updates
331
- for a work that has been modified or installed by the recipient, or for
332
- the User Product in which it has been modified or installed. Access to a
333
- network may be denied when the modification itself materially and
334
- adversely affects the operation of the network or violates the rules and
335
- protocols for communication across the network.
336
-
337
- Corresponding Source conveyed, and Installation Information provided,
338
- in accord with this section must be in a format that is publicly
339
- documented (and with an implementation available to the public in
340
- source code form), and must require no special password or key for
341
- unpacking, reading or copying.
342
-
343
- 7. Additional Terms.
344
-
345
- "Additional permissions" are terms that supplement the terms of this
346
- License by making exceptions from one or more of its conditions.
347
- Additional permissions that are applicable to the entire Program shall
348
- be treated as though they were included in this License, to the extent
349
- that they are valid under applicable law. If additional permissions
350
- apply only to part of the Program, that part may be used separately
351
- under those permissions, but the entire Program remains governed by
352
- this License without regard to the additional permissions.
353
-
354
- When you convey a copy of a covered work, you may at your option
355
- remove any additional permissions from that copy, or from any part of
356
- it. (Additional permissions may be written to require their own
357
- removal in certain cases when you modify the work.) You may place
358
- additional permissions on material, added by you to a covered work,
359
- for which you have or can give appropriate copyright permission.
360
-
361
- Notwithstanding any other provision of this License, for material you
362
- add to a covered work, you may (if authorized by the copyright holders of
363
- that material) supplement the terms of this License with terms:
364
-
365
- a) Disclaiming warranty or limiting liability differently from the
366
- terms of sections 15 and 16 of this License; or
367
-
368
- b) Requiring preservation of specified reasonable legal notices or
369
- author attributions in that material or in the Appropriate Legal
370
- Notices displayed by works containing it; or
371
-
372
- c) Prohibiting misrepresentation of the origin of that material, or
373
- requiring that modified versions of such material be marked in
374
- reasonable ways as different from the original version; or
375
-
376
- d) Limiting the use for publicity purposes of names of licensors or
377
- authors of the material; or
378
-
379
- e) Declining to grant rights under trademark law for use of some
380
- trade names, trademarks, or service marks; or
381
-
382
- f) Requiring indemnification of licensors and authors of that
383
- material by anyone who conveys the material (or modified versions of
384
- it) with contractual assumptions of liability to the recipient, for
385
- any liability that these contractual assumptions directly impose on
386
- those licensors and authors.
387
-
388
- All other non-permissive additional terms are considered "further
389
- restrictions" within the meaning of section 10. If the Program as you
390
- received it, or any part of it, contains a notice stating that it is
391
- governed by this License along with a term that is a further
392
- restriction, you may remove that term. If a license document contains
393
- a further restriction but permits relicensing or conveying under this
394
- License, you may add to a covered work material governed by the terms
395
- of that license document, provided that the further restriction does
396
- not survive such relicensing or conveying.
397
-
398
- If you add terms to a covered work in accord with this section, you
399
- must place, in the relevant source files, a statement of the
400
- additional terms that apply to those files, or a notice indicating
401
- where to find the applicable terms.
402
-
403
- Additional terms, permissive or non-permissive, may be stated in the
404
- form of a separately written license, or stated as exceptions;
405
- the above requirements apply either way.
406
-
407
- 8. Termination.
408
-
409
- You may not propagate or modify a covered work except as expressly
410
- provided under this License. Any attempt otherwise to propagate or
411
- modify it is void, and will automatically terminate your rights under
412
- this License (including any patent licenses granted under the third
413
- paragraph of section 11).
414
-
415
- However, if you cease all violation of this License, then your
416
- license from a particular copyright holder is reinstated (a)
417
- provisionally, unless and until the copyright holder explicitly and
418
- finally terminates your license, and (b) permanently, if the copyright
419
- holder fails to notify you of the violation by some reasonable means
420
- prior to 60 days after the cessation.
421
-
422
- Moreover, your license from a particular copyright holder is
423
- reinstated permanently if the copyright holder notifies you of the
424
- violation by some reasonable means, this is the first time you have
425
- received notice of violation of this License (for any work) from that
426
- copyright holder, and you cure the violation prior to 30 days after
427
- your receipt of the notice.
428
-
429
- Termination of your rights under this section does not terminate the
430
- licenses of parties who have received copies or rights from you under
431
- this License. If your rights have been terminated and not permanently
432
- reinstated, you do not qualify to receive new licenses for the same
433
- material under section 10.
434
-
435
- 9. Acceptance Not Required for Having Copies.
436
-
437
- You are not required to accept this License in order to receive or
438
- run a copy of the Program. Ancillary propagation of a covered work
439
- occurring solely as a consequence of using peer-to-peer transmission
440
- to receive a copy likewise does not require acceptance. However,
441
- nothing other than this License grants you permission to propagate or
442
- modify any covered work. These actions infringe copyright if you do
443
- not accept this License. Therefore, by modifying or propagating a
444
- covered work, you indicate your acceptance of this License to do so.
445
-
446
- 10. Automatic Licensing of Downstream Recipients.
447
-
448
- Each time you convey a covered work, the recipient automatically
449
- receives a license from the original licensors, to run, modify and
450
- propagate that work, subject to this License. You are not responsible
451
- for enforcing compliance by third parties with this License.
452
-
453
- An "entity transaction" is a transaction transferring control of an
454
- organization, or substantially all assets of one, or subdividing an
455
- organization, or merging organizations. If propagation of a covered
456
- work results from an entity transaction, each party to that
457
- transaction who receives a copy of the work also receives whatever
458
- licenses to the work the party's predecessor in interest had or could
459
- give under the previous paragraph, plus a right to possession of the
460
- Corresponding Source of the work from the predecessor in interest, if
461
- the predecessor has it or can get it with reasonable efforts.
462
-
463
- You may not impose any further restrictions on the exercise of the
464
- rights granted or affirmed under this License. For example, you may
465
- not impose a license fee, royalty, or other charge for exercise of
466
- rights granted under this License, and you may not initiate litigation
467
- (including a cross-claim or counterclaim in a lawsuit) alleging that
468
- any patent claim is infringed by making, using, selling, offering for
469
- sale, or importing the Program or any portion of it.
470
-
471
- 11. Patents.
472
-
473
- A "contributor" is a copyright holder who authorizes use under this
474
- License of the Program or a work on which the Program is based. The
475
- work thus licensed is called the contributor's "contributor version".
476
-
477
- A contributor's "essential patent claims" are all patent claims
478
- owned or controlled by the contributor, whether already acquired or
479
- hereafter acquired, that would be infringed by some manner, permitted
480
- by this License, of making, using, or selling its contributor version,
481
- but do not include claims that would be infringed only as a
482
- consequence of further modification of the contributor version. For
483
- purposes of this definition, "control" includes the right to grant
484
- patent sublicenses in a manner consistent with the requirements of
485
- this License.
486
-
487
- Each contributor grants you a non-exclusive, worldwide, royalty-free
488
- patent license under the contributor's essential patent claims, to
489
- make, use, sell, offer for sale, import and otherwise run, modify and
490
- propagate the contents of its contributor version.
491
-
492
- In the following three paragraphs, a "patent license" is any express
493
- agreement or commitment, however denominated, not to enforce a patent
494
- (such as an express permission to practice a patent or covenant not to
495
- sue for patent infringement). To "grant" such a patent license to a
496
- party means to make such an agreement or commitment not to enforce a
497
- patent against the party.
498
-
499
- If you convey a covered work, knowingly relying on a patent license,
500
- and the Corresponding Source of the work is not available for anyone
501
- to copy, free of charge and under the terms of this License, through a
502
- publicly available network server or other readily accessible means,
503
- then you must either (1) cause the Corresponding Source to be so
504
- available, or (2) arrange to deprive yourself of the benefit of the
505
- patent license for this particular work, or (3) arrange, in a manner
506
- consistent with the requirements of this License, to extend the patent
507
- license to downstream recipients. "Knowingly relying" means you have
508
- actual knowledge that, but for the patent license, your conveying the
509
- covered work in a country, or your recipient's use of the covered work
510
- in a country, would infringe one or more identifiable patents in that
511
- country that you have reason to believe are valid.
512
-
513
- If, pursuant to or in connection with a single transaction or
514
- arrangement, you convey, or propagate by procuring conveyance of, a
515
- covered work, and grant a patent license to some of the parties
516
- receiving the covered work authorizing them to use, propagate, modify
517
- or convey a specific copy of the covered work, then the patent license
518
- you grant is automatically extended to all recipients of the covered
519
- work and works based on it.
520
-
521
- A patent license is "discriminatory" if it does not include within
522
- the scope of its coverage, prohibits the exercise of, or is
523
- conditioned on the non-exercise of one or more of the rights that are
524
- specifically granted under this License. You may not convey a covered
525
- work if you are a party to an arrangement with a third party that is
526
- in the business of distributing software, under which you make payment
527
- to the third party based on the extent of your activity of conveying
528
- the work, and under which the third party grants, to any of the
529
- parties who would receive the covered work from you, a discriminatory
530
- patent license (a) in connection with copies of the covered work
531
- conveyed by you (or copies made from those copies), or (b) primarily
532
- for and in connection with specific products or compilations that
533
- contain the covered work, unless you entered into that arrangement,
534
- or that patent license was granted, prior to 28 March 2007.
535
-
536
- Nothing in this License shall be construed as excluding or limiting
537
- any implied license or other defenses to infringement that may
538
- otherwise be available to you under applicable patent law.
539
-
540
- 12. No Surrender of Others' Freedom.
541
-
542
- If conditions are imposed on you (whether by court order, agreement or
543
- otherwise) that contradict the conditions of this License, they do not
544
- excuse you from the conditions of this License. If you cannot convey a
545
- covered work so as to satisfy simultaneously your obligations under this
546
- License and any other pertinent obligations, then as a consequence you may
547
- not convey it at all. For example, if you agree to terms that obligate you
548
- to collect a royalty for further conveying from those to whom you convey
549
- the Program, the only way you could satisfy both those terms and this
550
- License would be to refrain entirely from conveying the Program.
551
-
552
- 13. Use with the GNU Affero General Public License.
553
-
554
- Notwithstanding any other provision of this License, you have
555
- permission to link or combine any covered work with a work licensed
556
- under version 3 of the GNU Affero General Public License into a single
557
- combined work, and to convey the resulting work. The terms of this
558
- License will continue to apply to the part which is the covered work,
559
- but the special requirements of the GNU Affero General Public License,
560
- section 13, concerning interaction through a network will apply to the
561
- combination as such.
562
-
563
- 14. Revised Versions of this License.
564
-
565
- The Free Software Foundation may publish revised and/or new versions of
566
- the GNU General Public License from time to time. Such new versions will
567
- be similar in spirit to the present version, but may differ in detail to
568
- address new problems or concerns.
569
-
570
- Each version is given a distinguishing version number. If the
571
- Program specifies that a certain numbered version of the GNU General
572
- Public License "or any later version" applies to it, you have the
573
- option of following the terms and conditions either of that numbered
574
- version or of any later version published by the Free Software
575
- Foundation. If the Program does not specify a version number of the
576
- GNU General Public License, you may choose any version ever published
577
- by the Free Software Foundation.
578
-
579
- If the Program specifies that a proxy can decide which future
580
- versions of the GNU General Public License can be used, that proxy's
581
- public statement of acceptance of a version permanently authorizes you
582
- to choose that version for the Program.
583
-
584
- Later license versions may give you additional or different
585
- permissions. However, no additional obligations are imposed on any
586
- author or copyright holder as a result of your choosing to follow a
587
- later version.
588
-
589
- 15. Disclaimer of Warranty.
590
-
591
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
- APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
- HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
- OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
- PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
- IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
- ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
-
600
- 16. Limitation of Liability.
601
-
602
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
- THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
- GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
- USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
- DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
- PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
- EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
- SUCH DAMAGES.
611
-
612
- 17. Interpretation of Sections 15 and 16.
613
-
614
- If the disclaimer of warranty and limitation of liability provided
615
- above cannot be given local legal effect according to their terms,
616
- reviewing courts shall apply local law that most closely approximates
617
- an absolute waiver of all civil liability in connection with the
618
- Program, unless a warranty or assumption of liability accompanies a
619
- copy of the Program in return for a fee.
620
-
621
- END OF TERMS AND CONDITIONS
622
-
623
- How to Apply These Terms to Your New Programs
624
-
625
- If you develop a new program, and you want it to be of the greatest
626
- possible use to the public, the best way to achieve this is to make it
627
- free software which everyone can redistribute and change under these terms.
628
-
629
- To do so, attach the following notices to the program. It is safest
630
- to attach them to the start of each source file to most effectively
631
- state the exclusion of warranty; and each file should have at least
632
- the "copyright" line and a pointer to where the full notice is found.
633
-
634
- <one line to give the program's name and a brief idea of what it does.>
635
- Copyright (C) <year> <name of author>
636
-
637
- This program is free software: you can redistribute it and/or modify
638
- it under the terms of the GNU General Public License as published by
639
- the Free Software Foundation, either version 3 of the License, or
640
- (at your option) any later version.
641
-
642
- This program is distributed in the hope that it will be useful,
643
- but WITHOUT ANY WARRANTY; without even the implied warranty of
644
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
- GNU General Public License for more details.
646
-
647
- You should have received a copy of the GNU General Public License
648
- along with this program. If not, see <http://www.gnu.org/licenses/>.
649
-
650
- Also add information on how to contact you by electronic and paper mail.
651
-
652
- If the program does terminal interaction, make it output a short
653
- notice like this when it starts in an interactive mode:
654
-
655
- <program> Copyright (C) <year> <name of author>
656
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
- This is free software, and you are welcome to redistribute it
658
- under certain conditions; type `show c' for details.
659
-
660
- The hypothetical commands `show w' and `show c' should show the appropriate
661
- parts of the General Public License. Of course, your program's commands
662
- might be different; for a GUI interface, you would use an "about box".
663
-
664
- You should also get your employer (if you work as a programmer) or school,
665
- if any, to sign a "copyright disclaimer" for the program, if necessary.
666
- For more information on this, and how to apply and follow the GNU GPL, see
667
- <http://www.gnu.org/licenses/>.
668
-
669
- The GNU General Public License does not permit incorporating your program
670
- into proprietary programs. If your program is a subroutine library, you
671
- may consider it more useful to permit linking proprietary applications with
672
- the library. If this is what you want to do, use the GNU Lesser General
673
- Public License instead of this License. But first, please read
674
- <http://www.gnu.org/philosophy/why-not-lgpl.html>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/COPYING.LESSER.3 DELETED
@@ -1,165 +0,0 @@
1
- GNU LESSER GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
-
9
- This version of the GNU Lesser General Public License incorporates
10
- the terms and conditions of version 3 of the GNU General Public
11
- License, supplemented by the additional permissions listed below.
12
-
13
- 0. Additional Definitions.
14
-
15
- As used herein, "this License" refers to version 3 of the GNU Lesser
16
- General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
- General Public License.
18
-
19
- "The Library" refers to a covered work governed by this License,
20
- other than an Application or a Combined Work as defined below.
21
-
22
- An "Application" is any work that makes use of an interface provided
23
- by the Library, but which is not otherwise based on the Library.
24
- Defining a subclass of a class defined by the Library is deemed a mode
25
- of using an interface provided by the Library.
26
-
27
- A "Combined Work" is a work produced by combining or linking an
28
- Application with the Library. The particular version of the Library
29
- with which the Combined Work was made is also called the "Linked
30
- Version".
31
-
32
- The "Minimal Corresponding Source" for a Combined Work means the
33
- Corresponding Source for the Combined Work, excluding any source code
34
- for portions of the Combined Work that, considered in isolation, are
35
- based on the Application, and not on the Linked Version.
36
-
37
- The "Corresponding Application Code" for a Combined Work means the
38
- object code and/or source code for the Application, including any data
39
- and utility programs needed for reproducing the Combined Work from the
40
- Application, but excluding the System Libraries of the Combined Work.
41
-
42
- 1. Exception to Section 3 of the GNU GPL.
43
-
44
- You may convey a covered work under sections 3 and 4 of this License
45
- without being bound by section 3 of the GNU GPL.
46
-
47
- 2. Conveying Modified Versions.
48
-
49
- If you modify a copy of the Library, and, in your modifications, a
50
- facility refers to a function or data to be supplied by an Application
51
- that uses the facility (other than as an argument passed when the
52
- facility is invoked), then you may convey a copy of the modified
53
- version:
54
-
55
- a) under this License, provided that you make a good faith effort to
56
- ensure that, in the event an Application does not supply the
57
- function or data, the facility still operates, and performs
58
- whatever part of its purpose remains meaningful, or
59
-
60
- b) under the GNU GPL, with none of the additional permissions of
61
- this License applicable to that copy.
62
-
63
- 3. Object Code Incorporating Material from Library Header Files.
64
-
65
- The object code form of an Application may incorporate material from
66
- a header file that is part of the Library. You may convey such object
67
- code under terms of your choice, provided that, if the incorporated
68
- material is not limited to numerical parameters, data structure
69
- layouts and accessors, or small macros, inline functions and templates
70
- (ten or fewer lines in length), you do both of the following:
71
-
72
- a) Give prominent notice with each copy of the object code that the
73
- Library is used in it and that the Library and its use are
74
- covered by this License.
75
-
76
- b) Accompany the object code with a copy of the GNU GPL and this license
77
- document.
78
-
79
- 4. Combined Works.
80
-
81
- You may convey a Combined Work under terms of your choice that,
82
- taken together, effectively do not restrict modification of the
83
- portions of the Library contained in the Combined Work and reverse
84
- engineering for debugging such modifications, if you also do each of
85
- the following:
86
-
87
- a) Give prominent notice with each copy of the Combined Work that
88
- the Library is used in it and that the Library and its use are
89
- covered by this License.
90
-
91
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
- document.
93
-
94
- c) For a Combined Work that displays copyright notices during
95
- execution, include the copyright notice for the Library among
96
- these notices, as well as a reference directing the user to the
97
- copies of the GNU GPL and this license document.
98
-
99
- d) Do one of the following:
100
-
101
- 0) Convey the Minimal Corresponding Source under the terms of this
102
- License, and the Corresponding Application Code in a form
103
- suitable for, and under terms that permit, the user to
104
- recombine or relink the Application with a modified version of
105
- the Linked Version to produce a modified Combined Work, in the
106
- manner specified by section 6 of the GNU GPL for conveying
107
- Corresponding Source.
108
-
109
- 1) Use a suitable shared library mechanism for linking with the
110
- Library. A suitable mechanism is one that (a) uses at run time
111
- a copy of the Library already present on the user's computer
112
- system, and (b) will operate properly with a modified version
113
- of the Library that is interface-compatible with the Linked
114
- Version.
115
-
116
- e) Provide Installation Information, but only if you would otherwise
117
- be required to provide such information under section 6 of the
118
- GNU GPL, and only to the extent that such information is
119
- necessary to install and execute a modified version of the
120
- Combined Work produced by recombining or relinking the
121
- Application with a modified version of the Linked Version. (If
122
- you use option 4d0, the Installation Information must accompany
123
- the Minimal Corresponding Source and Corresponding Application
124
- Code. If you use option 4d1, you must provide the Installation
125
- Information in the manner specified by section 6 of the GNU GPL
126
- for conveying Corresponding Source.)
127
-
128
- 5. Combined Libraries.
129
-
130
- You may place library facilities that are a work based on the
131
- Library side by side in a single library together with other library
132
- facilities that are not Applications and are not covered by this
133
- License, and convey such a combined library under terms of your
134
- choice, if you do both of the following:
135
-
136
- a) Accompany the combined library with a copy of the same work based
137
- on the Library, uncombined with any other library facilities,
138
- conveyed under the terms of this License.
139
-
140
- b) Give prominent notice with the combined library that part of it
141
- is a work based on the Library, and explaining where to find the
142
- accompanying uncombined form of the same work.
143
-
144
- 6. Revised Versions of the GNU Lesser General Public License.
145
-
146
- The Free Software Foundation may publish revised and/or new versions
147
- of the GNU Lesser General Public License from time to time. Such new
148
- versions will be similar in spirit to the present version, but may
149
- differ in detail to address new problems or concerns.
150
-
151
- Each version is given a distinguishing version number. If the
152
- Library as you received it specifies that a certain numbered version
153
- of the GNU Lesser General Public License "or any later version"
154
- applies to it, you have the option of following the terms and
155
- conditions either of that published version or of any later version
156
- published by the Free Software Foundation. If the Library as you
157
- received it does not specify a version number of the GNU Lesser
158
- General Public License, you may choose any version of the GNU Lesser
159
- General Public License ever published by the Free Software Foundation.
160
-
161
- If the Library as you received it specifies that a proxy can decide
162
- whether future versions of the GNU Lesser General Public License shall
163
- apply, that proxy's public statement of acceptance of any version is
164
- permanent authorization for you to choose that version for the
165
- Library.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/Doxyfile DELETED
@@ -1,1519 +0,0 @@
1
- # Doxyfile 1.6.1
2
-
3
- # This file describes the settings to be used by the documentation system
4
- # doxygen (www.doxygen.org) for a project
5
- #
6
- # All text after a hash (#) is considered a comment and will be ignored
7
- # The format is:
8
- # TAG = value [value, ...]
9
- # For lists items can also be appended using:
10
- # TAG += value [value, ...]
11
- # Values that contain spaces should be placed between quotes (" ")
12
-
13
- #---------------------------------------------------------------------------
14
- # Project related configuration options
15
- #---------------------------------------------------------------------------
16
-
17
- # This tag specifies the encoding used for all characters in the config file
18
- # that follow. The default is UTF-8 which is also the encoding used for all
19
- # text before the first occurrence of this tag. Doxygen uses libiconv (or the
20
- # iconv built into libc) for the transcoding. See
21
- # http://www.gnu.org/software/libiconv for the list of possible encodings.
22
-
23
- DOXYFILE_ENCODING = UTF-8
24
-
25
- # The PROJECT_NAME tag is a single word (or a sequence of words surrounded
26
- # by quotes) that should identify the project.
27
-
28
- PROJECT_NAME = KenLM
29
-
30
- # The PROJECT_NUMBER tag can be used to enter a project or revision number.
31
- # This could be handy for archiving the generated documentation or
32
- # if some version control system is used.
33
-
34
- PROJECT_NUMBER =
35
-
36
- # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
37
- # base path where the generated documentation will be put.
38
- # If a relative path is entered, it will be relative to the location
39
- # where doxygen was started. If left blank the current directory will be used.
40
-
41
- OUTPUT_DIRECTORY = doc
42
-
43
- # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
44
- # 4096 sub-directories (in 2 levels) under the output directory of each output
45
- # format and will distribute the generated files over these directories.
46
- # Enabling this option can be useful when feeding doxygen a huge amount of
47
- # source files, where putting all generated files in the same directory would
48
- # otherwise cause performance problems for the file system.
49
-
50
- CREATE_SUBDIRS = NO
51
-
52
- # The OUTPUT_LANGUAGE tag is used to specify the language in which all
53
- # documentation generated by doxygen is written. Doxygen will use this
54
- # information to generate all constant output in the proper language.
55
- # The default language is English, other supported languages are:
56
- # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
57
- # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
58
- # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
59
- # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
60
- # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
61
- # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
62
-
63
- OUTPUT_LANGUAGE = English
64
-
65
- # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
66
- # include brief member descriptions after the members that are listed in
67
- # the file and class documentation (similar to JavaDoc).
68
- # Set to NO to disable this.
69
-
70
- BRIEF_MEMBER_DESC = YES
71
-
72
- # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
73
- # the brief description of a member or function before the detailed description.
74
- # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
75
- # brief descriptions will be completely suppressed.
76
-
77
- REPEAT_BRIEF = YES
78
-
79
- # This tag implements a quasi-intelligent brief description abbreviator
80
- # that is used to form the text in various listings. Each string
81
- # in this list, if found as the leading text of the brief description, will be
82
- # stripped from the text and the result after processing the whole list, is
83
- # used as the annotated text. Otherwise, the brief description is used as-is.
84
- # If left blank, the following values are used ("$name" is automatically
85
- # replaced with the name of the entity): "The $name class" "The $name widget"
86
- # "The $name file" "is" "provides" "specifies" "contains"
87
- # "represents" "a" "an" "the"
88
-
89
- ABBREVIATE_BRIEF =
90
-
91
- # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
92
- # Doxygen will generate a detailed section even if there is only a brief
93
- # description.
94
-
95
- ALWAYS_DETAILED_SEC = YES
96
-
97
- # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
98
- # inherited members of a class in the documentation of that class as if those
99
- # members were ordinary class members. Constructors, destructors and assignment
100
- # operators of the base classes will not be shown.
101
-
102
- INLINE_INHERITED_MEMB = NO
103
-
104
- # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
105
- # path before files name in the file list and in the header files. If set
106
- # to NO the shortest path that makes the file name unique will be used.
107
-
108
- FULL_PATH_NAMES = YES
109
-
110
- # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
111
- # can be used to strip a user-defined part of the path. Stripping is
112
- # only done if one of the specified strings matches the left-hand part of
113
- # the path. The tag can be used to show relative paths in the file list.
114
- # If left blank the directory from which doxygen is run is used as the
115
- # path to strip.
116
-
117
- STRIP_FROM_PATH =
118
-
119
- # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
120
- # the path mentioned in the documentation of a class, which tells
121
- # the reader which header file to include in order to use a class.
122
- # If left blank only the name of the header file containing the class
123
- # definition is used. Otherwise one should specify the include paths that
124
- # are normally passed to the compiler using the -I flag.
125
-
126
- STRIP_FROM_INC_PATH =
127
-
128
- # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
129
- # (but less readable) file names. This can be useful is your file systems
130
- # doesn't support long names like on DOS, Mac, or CD-ROM.
131
-
132
- SHORT_NAMES = NO
133
-
134
- # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
135
- # will interpret the first line (until the first dot) of a JavaDoc-style
136
- # comment as the brief description. If set to NO, the JavaDoc
137
- # comments will behave just like regular Qt-style comments
138
- # (thus requiring an explicit @brief command for a brief description.)
139
-
140
- JAVADOC_AUTOBRIEF = YES
141
-
142
- # If the QT_AUTOBRIEF tag is set to YES then Doxygen will
143
- # interpret the first line (until the first dot) of a Qt-style
144
- # comment as the brief description. If set to NO, the comments
145
- # will behave just like regular Qt-style comments (thus requiring
146
- # an explicit \brief command for a brief description.)
147
-
148
- QT_AUTOBRIEF = NO
149
-
150
- # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
151
- # treat a multi-line C++ special comment block (i.e. a block of //! or ///
152
- # comments) as a brief description. This used to be the default behaviour.
153
- # The new default is to treat a multi-line C++ comment block as a detailed
154
- # description. Set this tag to YES if you prefer the old behaviour instead.
155
-
156
- MULTILINE_CPP_IS_BRIEF = NO
157
-
158
- # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
159
- # member inherits the documentation from any documented member that it
160
- # re-implements.
161
-
162
- INHERIT_DOCS = YES
163
-
164
- # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
165
- # a new page for each member. If set to NO, the documentation of a member will
166
- # be part of the file/class/namespace that contains it.
167
-
168
- SEPARATE_MEMBER_PAGES = NO
169
-
170
- # The TAB_SIZE tag can be used to set the number of spaces in a tab.
171
- # Doxygen uses this value to replace tabs by spaces in code fragments.
172
-
173
- TAB_SIZE = 8
174
-
175
- # This tag can be used to specify a number of aliases that acts
176
- # as commands in the documentation. An alias has the form "name=value".
177
- # For example adding "sideeffect=\par Side Effects:\n" will allow you to
178
- # put the command \sideeffect (or @sideeffect) in the documentation, which
179
- # will result in a user-defined paragraph with heading "Side Effects:".
180
- # You can put \n's in the value part of an alias to insert newlines.
181
-
182
- ALIASES =
183
-
184
- # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
185
- # sources only. Doxygen will then generate output that is more tailored for C.
186
- # For instance, some of the names that are used will be different. The list
187
- # of all members will be omitted, etc.
188
-
189
- OPTIMIZE_OUTPUT_FOR_C = NO
190
-
191
- # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
192
- # sources only. Doxygen will then generate output that is more tailored for
193
- # Java. For instance, namespaces will be presented as packages, qualified
194
- # scopes will look different, etc.
195
-
196
- OPTIMIZE_OUTPUT_JAVA = NO
197
-
198
- # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
199
- # sources only. Doxygen will then generate output that is more tailored for
200
- # Fortran.
201
-
202
- OPTIMIZE_FOR_FORTRAN = NO
203
-
204
- # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
205
- # sources. Doxygen will then generate output that is tailored for
206
- # VHDL.
207
-
208
- OPTIMIZE_OUTPUT_VHDL = NO
209
-
210
- # Doxygen selects the parser to use depending on the extension of the files it parses.
211
- # With this tag you can assign which parser to use for a given extension.
212
- # Doxygen has a built-in mapping, but you can override or extend it using this tag.
213
- # The format is ext=language, where ext is a file extension, and language is one of
214
- # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
215
- # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
216
- # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
217
- # use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
218
-
219
- EXTENSION_MAPPING =
220
-
221
- # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
222
- # to include (a tag file for) the STL sources as input, then you should
223
- # set this tag to YES in order to let doxygen match functions declarations and
224
- # definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
225
- # func(std::string) {}). This also make the inheritance and collaboration
226
- # diagrams that involve STL classes more complete and accurate.
227
-
228
- BUILTIN_STL_SUPPORT = NO
229
-
230
- # If you use Microsoft's C++/CLI language, you should set this option to YES to
231
- # enable parsing support.
232
-
233
- CPP_CLI_SUPPORT = NO
234
-
235
- # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
236
- # Doxygen will parse them like normal C++ but will assume all classes use public
237
- # instead of private inheritance when no explicit protection keyword is present.
238
-
239
- SIP_SUPPORT = NO
240
-
241
- # For Microsoft's IDL there are propget and propput attributes to indicate getter
242
- # and setter methods for a property. Setting this option to YES (the default)
243
- # will make doxygen to replace the get and set methods by a property in the
244
- # documentation. This will only work if the methods are indeed getting or
245
- # setting a simple type. If this is not the case, or you want to show the
246
- # methods anyway, you should set this option to NO.
247
-
248
- IDL_PROPERTY_SUPPORT = YES
249
-
250
- # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
251
- # tag is set to YES, then doxygen will reuse the documentation of the first
252
- # member in the group (if any) for the other members of the group. By default
253
- # all members of a group must be documented explicitly.
254
-
255
- DISTRIBUTE_GROUP_DOC = NO
256
-
257
- # Set the SUBGROUPING tag to YES (the default) to allow class member groups of
258
- # the same type (for instance a group of public functions) to be put as a
259
- # subgroup of that type (e.g. under the Public Functions section). Set it to
260
- # NO to prevent subgrouping. Alternatively, this can be done per class using
261
- # the \nosubgrouping command.
262
-
263
- SUBGROUPING = YES
264
-
265
- # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
266
- # is documented as struct, union, or enum with the name of the typedef. So
267
- # typedef struct TypeS {} TypeT, will appear in the documentation as a struct
268
- # with name TypeT. When disabled the typedef will appear as a member of a file,
269
- # namespace, or class. And the struct will be named TypeS. This can typically
270
- # be useful for C code in case the coding convention dictates that all compound
271
- # types are typedef'ed and only the typedef is referenced, never the tag name.
272
-
273
- TYPEDEF_HIDES_STRUCT = NO
274
-
275
- # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
276
- # determine which symbols to keep in memory and which to flush to disk.
277
- # When the cache is full, less often used symbols will be written to disk.
278
- # For small to medium size projects (<1000 input files) the default value is
279
- # probably good enough. For larger projects a too small cache size can cause
280
- # doxygen to be busy swapping symbols to and from disk most of the time
281
- # causing a significant performance penality.
282
- # If the system has enough physical memory increasing the cache will improve the
283
- # performance by keeping more symbols in memory. Note that the value works on
284
- # a logarithmic scale so increasing the size by one will rougly double the
285
- # memory usage. The cache size is given by this formula:
286
- # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
287
- # corresponding to a cache size of 2^16 = 65536 symbols
288
-
289
- SYMBOL_CACHE_SIZE = 0
290
-
291
- #---------------------------------------------------------------------------
292
- # Build related configuration options
293
- #---------------------------------------------------------------------------
294
-
295
- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
296
- # documentation are documented, even if no documentation was available.
297
- # Private class members and static file members will be hidden unless
298
- # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
299
-
300
- EXTRACT_ALL = NO
301
-
302
- # If the EXTRACT_PRIVATE tag is set to YES all private members of a class
303
- # will be included in the documentation.
304
-
305
- EXTRACT_PRIVATE = YES
306
-
307
- # If the EXTRACT_STATIC tag is set to YES all static members of a file
308
- # will be included in the documentation.
309
-
310
- EXTRACT_STATIC = NO
311
-
312
- # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
313
- # defined locally in source files will be included in the documentation.
314
- # If set to NO only classes defined in header files are included.
315
-
316
- EXTRACT_LOCAL_CLASSES = YES
317
-
318
- # This flag is only useful for Objective-C code. When set to YES local
319
- # methods, which are defined in the implementation section but not in
320
- # the interface are included in the documentation.
321
- # If set to NO (the default) only methods in the interface are included.
322
-
323
- EXTRACT_LOCAL_METHODS = NO
324
-
325
- # If this flag is set to YES, the members of anonymous namespaces will be
326
- # extracted and appear in the documentation as a namespace called
327
- # 'anonymous_namespace{file}', where file will be replaced with the base
328
- # name of the file that contains the anonymous namespace. By default
329
- # anonymous namespace are hidden.
330
-
331
- EXTRACT_ANON_NSPACES = NO
332
-
333
- # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
334
- # undocumented members of documented classes, files or namespaces.
335
- # If set to NO (the default) these members will be included in the
336
- # various overviews, but no documentation section is generated.
337
- # This option has no effect if EXTRACT_ALL is enabled.
338
-
339
- HIDE_UNDOC_MEMBERS = YES
340
-
341
- # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
342
- # undocumented classes that are normally visible in the class hierarchy.
343
- # If set to NO (the default) these classes will be included in the various
344
- # overviews. This option has no effect if EXTRACT_ALL is enabled.
345
-
346
- HIDE_UNDOC_CLASSES = YES
347
-
348
- # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
349
- # friend (class|struct|union) declarations.
350
- # If set to NO (the default) these declarations will be included in the
351
- # documentation.
352
-
353
- HIDE_FRIEND_COMPOUNDS = NO
354
-
355
- # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
356
- # documentation blocks found inside the body of a function.
357
- # If set to NO (the default) these blocks will be appended to the
358
- # function's detailed documentation block.
359
-
360
- HIDE_IN_BODY_DOCS = NO
361
-
362
- # The INTERNAL_DOCS tag determines if documentation
363
- # that is typed after a \internal command is included. If the tag is set
364
- # to NO (the default) then the documentation will be excluded.
365
- # Set it to YES to include the internal documentation.
366
-
367
- INTERNAL_DOCS = NO
368
-
369
- # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
370
- # file names in lower-case letters. If set to YES upper-case letters are also
371
- # allowed. This is useful if you have classes or files whose names only differ
372
- # in case and if your file system supports case sensitive file names. Windows
373
- # and Mac users are advised to set this option to NO.
374
-
375
- CASE_SENSE_NAMES = YES
376
-
377
- # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
378
- # will show members with their full class and namespace scopes in the
379
- # documentation. If set to YES the scope will be hidden.
380
-
381
- HIDE_SCOPE_NAMES = NO
382
-
383
- # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
384
- # will put a list of the files that are included by a file in the documentation
385
- # of that file.
386
-
387
- SHOW_INCLUDE_FILES = YES
388
-
389
- # If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
390
- # is inserted in the documentation for inline members.
391
-
392
- INLINE_INFO = YES
393
-
394
- # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
395
- # will sort the (detailed) documentation of file and class members
396
- # alphabetically by member name. If set to NO the members will appear in
397
- # declaration order.
398
-
399
- SORT_MEMBER_DOCS = YES
400
-
401
- # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
402
- # brief documentation of file, namespace and class members alphabetically
403
- # by member name. If set to NO (the default) the members will appear in
404
- # declaration order.
405
-
406
- SORT_BRIEF_DOCS = NO
407
-
408
- # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
409
-
410
- SORT_MEMBERS_CTORS_1ST = YES
411
-
412
- # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
413
- # hierarchy of group names into alphabetical order. If set to NO (the default)
414
- # the group names will appear in their defined order.
415
-
416
- SORT_GROUP_NAMES = NO
417
-
418
- # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
419
- # sorted by fully-qualified names, including namespaces. If set to
420
- # NO (the default), the class list will be sorted only by class name,
421
- # not including the namespace part.
422
- # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
423
- # Note: This option applies only to the class list, not to the
424
- # alphabetical list.
425
-
426
- SORT_BY_SCOPE_NAME = YES
427
-
428
- # The GENERATE_TODOLIST tag can be used to enable (YES) or
429
- # disable (NO) the todo list. This list is created by putting \todo
430
- # commands in the documentation.
431
-
432
- GENERATE_TODOLIST = YES
433
-
434
- # The GENERATE_TESTLIST tag can be used to enable (YES) or
435
- # disable (NO) the test list. This list is created by putting \test
436
- # commands in the documentation.
437
-
438
- GENERATE_TESTLIST = YES
439
-
440
- # The GENERATE_BUGLIST tag can be used to enable (YES) or
441
- # disable (NO) the bug list. This list is created by putting \bug
442
- # commands in the documentation.
443
-
444
- GENERATE_BUGLIST = YES
445
-
446
- # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
447
- # disable (NO) the deprecated list. This list is created by putting
448
- # \deprecated commands in the documentation.
449
-
450
- GENERATE_DEPRECATEDLIST= YES
451
-
452
- # The ENABLED_SECTIONS tag can be used to enable conditional
453
- # documentation sections, marked by \if sectionname ... \endif.
454
-
455
- ENABLED_SECTIONS =
456
-
457
- # The MAX_INITIALIZER_LINES tag determines the maximum number of lines
458
- # the initial value of a variable or define consists of for it to appear in
459
- # the documentation. If the initializer consists of more lines than specified
460
- # here it will be hidden. Use a value of 0 to hide initializers completely.
461
- # The appearance of the initializer of individual variables and defines in the
462
- # documentation can be controlled using \showinitializer or \hideinitializer
463
- # command in the documentation regardless of this setting.
464
-
465
- MAX_INITIALIZER_LINES = 30
466
-
467
- # Set the SHOW_USED_FILES tag to NO to disable the list of files generated
468
- # at the bottom of the documentation of classes and structs. If set to YES the
469
- # list will mention the files that were used to generate the documentation.
470
-
471
- SHOW_USED_FILES = YES
472
-
473
- # If the sources in your project are distributed over multiple directories
474
- # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
475
- # in the documentation. The default is NO.
476
-
477
- SHOW_DIRECTORIES = NO
478
-
479
- # Set the SHOW_FILES tag to NO to disable the generation of the Files page.
480
- # This will remove the Files entry from the Quick Index and from the
481
- # Folder Tree View (if specified). The default is YES.
482
-
483
- SHOW_FILES = YES
484
-
485
- # Set the SHOW_NAMESPACES tag to NO to disable the generation of the
486
- # Namespaces page.
487
- # This will remove the Namespaces entry from the Quick Index
488
- # and from the Folder Tree View (if specified). The default is YES.
489
-
490
- SHOW_NAMESPACES = YES
491
-
492
- # The FILE_VERSION_FILTER tag can be used to specify a program or script that
493
- # doxygen should invoke to get the current version for each file (typically from
494
- # the version control system). Doxygen will invoke the program by executing (via
495
- # popen()) the command <command> <input-file>, where <command> is the value of
496
- # the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
497
- # provided by doxygen. Whatever the program writes to standard output
498
- # is used as the file version. See the manual for examples.
499
-
500
- FILE_VERSION_FILTER =
501
-
502
- # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
503
- # doxygen. The layout file controls the global structure of the generated output files
504
- # in an output format independent way. The create the layout file that represents
505
- # doxygen's defaults, run doxygen with the -l option. You can optionally specify a
506
- # file name after the option, if omitted DoxygenLayout.xml will be used as the name
507
- # of the layout file.
508
-
509
- LAYOUT_FILE =
510
-
511
- #---------------------------------------------------------------------------
512
- # configuration options related to warning and progress messages
513
- #---------------------------------------------------------------------------
514
-
515
- # The QUIET tag can be used to turn on/off the messages that are generated
516
- # by doxygen. Possible values are YES and NO. If left blank NO is used.
517
-
518
- QUIET = NO
519
-
520
- # The WARNINGS tag can be used to turn on/off the warning messages that are
521
- # generated by doxygen. Possible values are YES and NO. If left blank
522
- # NO is used.
523
-
524
- WARNINGS = YES
525
-
526
- # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
527
- # for undocumented members. If EXTRACT_ALL is set to YES then this flag will
528
- # automatically be disabled.
529
-
530
- WARN_IF_UNDOCUMENTED = YES
531
-
532
- # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
533
- # potential errors in the documentation, such as not documenting some
534
- # parameters in a documented function, or documenting parameters that
535
- # don't exist or using markup commands wrongly.
536
-
537
- WARN_IF_DOC_ERROR = YES
538
-
539
- # This WARN_NO_PARAMDOC option can be abled to get warnings for
540
- # functions that are documented, but have no documentation for their parameters
541
- # or return value. If set to NO (the default) doxygen will only warn about
542
- # wrong or incomplete parameter documentation, but not about the absence of
543
- # documentation.
544
-
545
- WARN_NO_PARAMDOC = NO
546
-
547
- # The WARN_FORMAT tag determines the format of the warning messages that
548
- # doxygen can produce. The string should contain the $file, $line, and $text
549
- # tags, which will be replaced by the file and line number from which the
550
- # warning originated and the warning text. Optionally the format may contain
551
- # $version, which will be replaced by the version of the file (if it could
552
- # be obtained via FILE_VERSION_FILTER)
553
-
554
- WARN_FORMAT = "$file:$line: $text"
555
-
556
- # The WARN_LOGFILE tag can be used to specify a file to which warning
557
- # and error messages should be written. If left blank the output is written
558
- # to stderr.
559
-
560
- WARN_LOGFILE =
561
-
562
- #---------------------------------------------------------------------------
563
- # configuration options related to the input files
564
- #---------------------------------------------------------------------------
565
-
566
- # The INPUT tag can be used to specify the files and/or directories that contain
567
- # documented source files. You may enter file names like "myfile.cpp" or
568
- # directories like "/usr/src/myproject". Separate the files or directories
569
- # with spaces.
570
-
571
- INPUT = lm lm/builder lm/filter lm/interpolate lm/wrappers util util/double-conversion util/stream
572
-
573
- # This tag can be used to specify the character encoding of the source files
574
- # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
575
- # also the default input encoding. Doxygen uses libiconv (or the iconv built
576
- # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
577
- # the list of possible encodings.
578
-
579
- INPUT_ENCODING = UTF-8
580
-
581
- # If the value of the INPUT tag contains directories, you can use the
582
- # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
583
- # and *.h) to filter out the source-files in the directories. If left
584
- # blank the following patterns are tested:
585
- # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
586
- # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
587
-
588
- FILE_PATTERNS =
589
-
590
- # The RECURSIVE tag can be used to turn specify whether or not subdirectories
591
- # should be searched for input files as well. Possible values are YES and NO.
592
- # If left blank NO is used.
593
-
594
- RECURSIVE = NO
595
-
596
- # The EXCLUDE tag can be used to specify files and/or directories that should
597
- # excluded from the INPUT source files. This way you can easily exclude a
598
- # subdirectory from a directory tree whose root is specified with the INPUT tag.
599
-
600
- EXCLUDE =
601
-
602
- # The EXCLUDE_SYMLINKS tag can be used select whether or not files or
603
- # directories that are symbolic links (a Unix filesystem feature) are excluded
604
- # from the input.
605
-
606
- EXCLUDE_SYMLINKS = NO
607
-
608
- # If the value of the INPUT tag contains directories, you can use the
609
- # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
610
- # certain files from those directories. Note that the wildcards are matched
611
- # against the file with absolute path, so to exclude all test directories
612
- # for example use the pattern */test/*
613
-
614
- EXCLUDE_PATTERNS =
615
-
616
- # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
617
- # (namespaces, classes, functions, etc.) that should be excluded from the
618
- # output. The symbol name can be a fully qualified name, a word, or if the
619
- # wildcard * is used, a substring. Examples: ANamespace, AClass,
620
- # AClass::ANamespace, ANamespace::*Test
621
-
622
- EXCLUDE_SYMBOLS =
623
-
624
- # The EXAMPLE_PATH tag can be used to specify one or more files or
625
- # directories that contain example code fragments that are included (see
626
- # the \include command).
627
-
628
- EXAMPLE_PATH =
629
-
630
- # If the value of the EXAMPLE_PATH tag contains directories, you can use the
631
- # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
632
- # and *.h) to filter out the source-files in the directories. If left
633
- # blank all files are included.
634
-
635
- EXAMPLE_PATTERNS =
636
-
637
- # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
638
- # searched for input files to be used with the \include or \dontinclude
639
- # commands irrespective of the value of the RECURSIVE tag.
640
- # Possible values are YES and NO. If left blank NO is used.
641
-
642
- EXAMPLE_RECURSIVE = NO
643
-
644
- # The IMAGE_PATH tag can be used to specify one or more files or
645
- # directories that contain image that are included in the documentation (see
646
- # the \image command).
647
-
648
- IMAGE_PATH =
649
-
650
- # The INPUT_FILTER tag can be used to specify a program that doxygen should
651
- # invoke to filter for each input file. Doxygen will invoke the filter program
652
- # by executing (via popen()) the command <filter> <input-file>, where <filter>
653
- # is the value of the INPUT_FILTER tag, and <input-file> is the name of an
654
- # input file. Doxygen will then use the output that the filter program writes
655
- # to standard output.
656
- # If FILTER_PATTERNS is specified, this tag will be
657
- # ignored.
658
-
659
- INPUT_FILTER =
660
-
661
- # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
662
- # basis.
663
- # Doxygen will compare the file name with each pattern and apply the
664
- # filter if there is a match.
665
- # The filters are a list of the form:
666
- # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
667
- # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
668
- # is applied to all files.
669
-
670
- FILTER_PATTERNS =
671
-
672
- # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
673
- # INPUT_FILTER) will be used to filter the input files when producing source
674
- # files to browse (i.e. when SOURCE_BROWSER is set to YES).
675
-
676
- FILTER_SOURCE_FILES = NO
677
-
678
- #---------------------------------------------------------------------------
679
- # configuration options related to source browsing
680
- #---------------------------------------------------------------------------
681
-
682
- # If the SOURCE_BROWSER tag is set to YES then a list of source files will
683
- # be generated. Documented entities will be cross-referenced with these sources.
684
- # Note: To get rid of all source code in the generated output, make sure also
685
- # VERBATIM_HEADERS is set to NO.
686
-
687
- SOURCE_BROWSER = NO
688
-
689
- # Setting the INLINE_SOURCES tag to YES will include the body
690
- # of functions and classes directly in the documentation.
691
-
692
- INLINE_SOURCES = NO
693
-
694
- # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
695
- # doxygen to hide any special comment blocks from generated source code
696
- # fragments. Normal C and C++ comments will always remain visible.
697
-
698
- STRIP_CODE_COMMENTS = YES
699
-
700
- # If the REFERENCED_BY_RELATION tag is set to YES
701
- # then for each documented function all documented
702
- # functions referencing it will be listed.
703
-
704
- REFERENCED_BY_RELATION = NO
705
-
706
- # If the REFERENCES_RELATION tag is set to YES
707
- # then for each documented function all documented entities
708
- # called/used by that function will be listed.
709
-
710
- REFERENCES_RELATION = NO
711
-
712
- # If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
713
- # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
714
- # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
715
- # link to the source code.
716
- # Otherwise they will link to the documentation.
717
-
718
- REFERENCES_LINK_SOURCE = YES
719
-
720
- # If the USE_HTAGS tag is set to YES then the references to source code
721
- # will point to the HTML generated by the htags(1) tool instead of doxygen
722
- # built-in source browser. The htags tool is part of GNU's global source
723
- # tagging system (see http://www.gnu.org/software/global/global.html). You
724
- # will need version 4.8.6 or higher.
725
-
726
- USE_HTAGS = NO
727
-
728
- # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
729
- # will generate a verbatim copy of the header file for each class for
730
- # which an include is specified. Set to NO to disable this.
731
-
732
- VERBATIM_HEADERS = YES
733
-
734
- #---------------------------------------------------------------------------
735
- # configuration options related to the alphabetical class index
736
- #---------------------------------------------------------------------------
737
-
738
- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
739
- # of all compounds will be generated. Enable this if the project
740
- # contains a lot of classes, structs, unions or interfaces.
741
-
742
- ALPHABETICAL_INDEX = NO
743
-
744
- # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
745
- # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
746
- # in which this list will be split (can be a number in the range [1..20])
747
-
748
- COLS_IN_ALPHA_INDEX = 5
749
-
750
- # In case all classes in a project start with a common prefix, all
751
- # classes will be put under the same header in the alphabetical index.
752
- # The IGNORE_PREFIX tag can be used to specify one or more prefixes that
753
- # should be ignored while generating the index headers.
754
-
755
- IGNORE_PREFIX =
756
-
757
- #---------------------------------------------------------------------------
758
- # configuration options related to the HTML output
759
- #---------------------------------------------------------------------------
760
-
761
- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will
762
- # generate HTML output.
763
-
764
- GENERATE_HTML = YES
765
-
766
- # The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
767
- # If a relative path is entered the value of OUTPUT_DIRECTORY will be
768
- # put in front of it. If left blank `html' will be used as the default path.
769
-
770
- HTML_OUTPUT = html
771
-
772
- # The HTML_FILE_EXTENSION tag can be used to specify the file extension for
773
- # each generated HTML page (for example: .htm,.php,.asp). If it is left blank
774
- # doxygen will generate files with .html extension.
775
-
776
- HTML_FILE_EXTENSION = .html
777
-
778
- # The HTML_HEADER tag can be used to specify a personal HTML header for
779
- # each generated HTML page. If it is left blank doxygen will generate a
780
- # standard header.
781
-
782
- HTML_HEADER =
783
-
784
- # The HTML_FOOTER tag can be used to specify a personal HTML footer for
785
- # each generated HTML page. If it is left blank doxygen will generate a
786
- # standard footer.
787
-
788
- HTML_FOOTER =
789
-
790
- # If the HTML_TIMESTAMP tag is set to YES then the generated HTML
791
- # documentation will contain the timesstamp.
792
-
793
- HTML_TIMESTAMP = NO
794
-
795
- # The HTML_STYLESHEET tag can be used to specify a user-defined cascading
796
- # style sheet that is used by each HTML page. It can be used to
797
- # fine-tune the look of the HTML output. If the tag is left blank doxygen
798
- # will generate a default style sheet. Note that doxygen will try to copy
799
- # the style sheet file to the HTML output directory, so don't put your own
800
- # stylesheet in the HTML output directory as well, or it will be erased!
801
-
802
- HTML_STYLESHEET =
803
-
804
- # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
805
- # files or namespaces will be aligned in HTML using tables. If set to
806
- # NO a bullet list will be used.
807
-
808
- HTML_ALIGN_MEMBERS = YES
809
-
810
- # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
811
- # documentation will contain sections that can be hidden and shown after the
812
- # page has loaded. For this to work a browser that supports
813
- # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
814
- # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
815
-
816
- HTML_DYNAMIC_SECTIONS = NO
817
-
818
- # If the GENERATE_DOCSET tag is set to YES, additional index files
819
- # will be generated that can be used as input for Apple's Xcode 3
820
- # integrated development environment, introduced with OSX 10.5 (Leopard).
821
- # To create a documentation set, doxygen will generate a Makefile in the
822
- # HTML output directory. Running make will produce the docset in that
823
- # directory and running "make install" will install the docset in
824
- # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
825
- # it at startup.
826
- # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
827
-
828
- GENERATE_DOCSET = NO
829
-
830
- # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
831
- # feed. A documentation feed provides an umbrella under which multiple
832
- # documentation sets from a single provider (such as a company or product suite)
833
- # can be grouped.
834
-
835
- DOCSET_FEEDNAME = "Doxygen generated docs"
836
-
837
- # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
838
- # should uniquely identify the documentation set bundle. This should be a
839
- # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
840
- # will append .docset to the name.
841
-
842
- DOCSET_BUNDLE_ID = org.doxygen.Project
843
-
844
- # If the GENERATE_HTMLHELP tag is set to YES, additional index files
845
- # will be generated that can be used as input for tools like the
846
- # Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
847
- # of the generated HTML documentation.
848
-
849
- GENERATE_HTMLHELP = NO
850
-
851
- # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
852
- # be used to specify the file name of the resulting .chm file. You
853
- # can add a path in front of the file if the result should not be
854
- # written to the html output directory.
855
-
856
- CHM_FILE =
857
-
858
- # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
859
- # be used to specify the location (absolute path including file name) of
860
- # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
861
- # the HTML help compiler on the generated index.hhp.
862
-
863
- HHC_LOCATION =
864
-
865
- # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
866
- # controls if a separate .chi index file is generated (YES) or that
867
- # it should be included in the master .chm file (NO).
868
-
869
- GENERATE_CHI = NO
870
-
871
- # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
872
- # is used to encode HtmlHelp index (hhk), content (hhc) and project file
873
- # content.
874
-
875
- CHM_INDEX_ENCODING =
876
-
877
- # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
878
- # controls whether a binary table of contents is generated (YES) or a
879
- # normal table of contents (NO) in the .chm file.
880
-
881
- BINARY_TOC = NO
882
-
883
- # The TOC_EXPAND flag can be set to YES to add extra items for group members
884
- # to the contents of the HTML help documentation and to the tree view.
885
-
886
- TOC_EXPAND = NO
887
-
888
- # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
889
- # are set, an additional index file will be generated that can be used as input for
890
- # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
891
- # HTML documentation.
892
-
893
- GENERATE_QHP = NO
894
-
895
- # If the QHG_LOCATION tag is specified, the QCH_FILE tag can
896
- # be used to specify the file name of the resulting .qch file.
897
- # The path specified is relative to the HTML output folder.
898
-
899
- QCH_FILE =
900
-
901
- # The QHP_NAMESPACE tag specifies the namespace to use when generating
902
- # Qt Help Project output. For more information please see
903
- # http://doc.trolltech.com/qthelpproject.html#namespace
904
-
905
- QHP_NAMESPACE =
906
-
907
- # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
908
- # Qt Help Project output. For more information please see
909
- # http://doc.trolltech.com/qthelpproject.html#virtual-folders
910
-
911
- QHP_VIRTUAL_FOLDER = doc
912
-
913
- # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
914
- # For more information please see
915
- # http://doc.trolltech.com/qthelpproject.html#custom-filters
916
-
917
- QHP_CUST_FILTER_NAME =
918
-
919
- # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
920
- # <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
921
-
922
- QHP_CUST_FILTER_ATTRS =
923
-
924
- # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
925
- # filter section matches.
926
- # <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
927
-
928
- QHP_SECT_FILTER_ATTRS =
929
-
930
- # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
931
- # be used to specify the location of Qt's qhelpgenerator.
932
- # If non-empty doxygen will try to run qhelpgenerator on the generated
933
- # .qhp file.
934
-
935
- QHG_LOCATION =
936
-
937
- # The DISABLE_INDEX tag can be used to turn on/off the condensed index at
938
- # top of each HTML page. The value NO (the default) enables the index and
939
- # the value YES disables it.
940
-
941
- DISABLE_INDEX = NO
942
-
943
- # This tag can be used to set the number of enum values (range [1..20])
944
- # that doxygen will group on one line in the generated HTML documentation.
945
-
946
- ENUM_VALUES_PER_LINE = 4
947
-
948
- # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
949
- # structure should be generated to display hierarchical information.
950
- # If the tag value is set to YES, a side panel will be generated
951
- # containing a tree-like index structure (just like the one that
952
- # is generated for HTML Help). For this to work a browser that supports
953
- # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
954
- # Windows users are probably better off using the HTML help feature.
955
-
956
- GENERATE_TREEVIEW = NO
957
-
958
- # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
959
- # and Class Hierarchy pages using a tree view instead of an ordered list.
960
-
961
- USE_INLINE_TREES = NO
962
-
963
- # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
964
- # used to set the initial width (in pixels) of the frame in which the tree
965
- # is shown.
966
-
967
- TREEVIEW_WIDTH = 250
968
-
969
- # Use this tag to change the font size of Latex formulas included
970
- # as images in the HTML documentation. The default is 10. Note that
971
- # when you change the font size after a successful doxygen run you need
972
- # to manually remove any form_*.png images from the HTML output directory
973
- # to force them to be regenerated.
974
-
975
- FORMULA_FONTSIZE = 10
976
-
977
- # When the SEARCHENGINE tag is enable doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
978
- # and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP)
979
- # there is already a search function so this one should typically
980
- # be disabled.
981
-
982
- SEARCHENGINE = YES
983
-
984
- #---------------------------------------------------------------------------
985
- # configuration options related to the LaTeX output
986
- #---------------------------------------------------------------------------
987
-
988
- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
989
- # generate Latex output.
990
-
991
- GENERATE_LATEX = YES
992
-
993
- # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
994
- # If a relative path is entered the value of OUTPUT_DIRECTORY will be
995
- # put in front of it. If left blank `latex' will be used as the default path.
996
-
997
- LATEX_OUTPUT = latex
998
-
999
- # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
1000
- # invoked. If left blank `latex' will be used as the default command name.
1001
-
1002
- LATEX_CMD_NAME = latex
1003
-
1004
- # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
1005
- # generate index for LaTeX. If left blank `makeindex' will be used as the
1006
- # default command name.
1007
-
1008
- MAKEINDEX_CMD_NAME = makeindex
1009
-
1010
- # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
1011
- # LaTeX documents. This may be useful for small projects and may help to
1012
- # save some trees in general.
1013
-
1014
- COMPACT_LATEX = NO
1015
-
1016
- # The PAPER_TYPE tag can be used to set the paper type that is used
1017
- # by the printer. Possible values are: a4, a4wide, letter, legal and
1018
- # executive. If left blank a4wide will be used.
1019
-
1020
- PAPER_TYPE = a4wide
1021
-
1022
- # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
1023
- # packages that should be included in the LaTeX output.
1024
-
1025
- EXTRA_PACKAGES =
1026
-
1027
- # The LATEX_HEADER tag can be used to specify a personal LaTeX header for
1028
- # the generated latex document. The header should contain everything until
1029
- # the first chapter. If it is left blank doxygen will generate a
1030
- # standard header. Notice: only use this tag if you know what you are doing!
1031
-
1032
- LATEX_HEADER =
1033
-
1034
- # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
1035
- # is prepared for conversion to pdf (using ps2pdf). The pdf file will
1036
- # contain links (just like the HTML output) instead of page references
1037
- # This makes the output suitable for online browsing using a pdf viewer.
1038
-
1039
- PDF_HYPERLINKS = YES
1040
-
1041
- # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
1042
- # plain latex in the generated Makefile. Set this option to YES to get a
1043
- # higher quality PDF documentation.
1044
-
1045
- USE_PDFLATEX = YES
1046
-
1047
- # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
1048
- # command to the generated LaTeX files. This will instruct LaTeX to keep
1049
- # running if errors occur, instead of asking the user for help.
1050
- # This option is also used when generating formulas in HTML.
1051
-
1052
- LATEX_BATCHMODE = NO
1053
-
1054
- # If LATEX_HIDE_INDICES is set to YES then doxygen will not
1055
- # include the index chapters (such as File Index, Compound Index, etc.)
1056
- # in the output.
1057
-
1058
- LATEX_HIDE_INDICES = NO
1059
-
1060
- # If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
1061
-
1062
- LATEX_SOURCE_CODE = NO
1063
-
1064
- #---------------------------------------------------------------------------
1065
- # configuration options related to the RTF output
1066
- #---------------------------------------------------------------------------
1067
-
1068
- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
1069
- # The RTF output is optimized for Word 97 and may not look very pretty with
1070
- # other RTF readers or editors.
1071
-
1072
- GENERATE_RTF = NO
1073
-
1074
- # The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
1075
- # If a relative path is entered the value of OUTPUT_DIRECTORY will be
1076
- # put in front of it. If left blank `rtf' will be used as the default path.
1077
-
1078
- RTF_OUTPUT = rtf
1079
-
1080
- # If the COMPACT_RTF tag is set to YES Doxygen generates more compact
1081
- # RTF documents. This may be useful for small projects and may help to
1082
- # save some trees in general.
1083
-
1084
- COMPACT_RTF = NO
1085
-
1086
- # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
1087
- # will contain hyperlink fields. The RTF file will
1088
- # contain links (just like the HTML output) instead of page references.
1089
- # This makes the output suitable for online browsing using WORD or other
1090
- # programs which support those fields.
1091
- # Note: wordpad (write) and others do not support links.
1092
-
1093
- RTF_HYPERLINKS = NO
1094
-
1095
- # Load stylesheet definitions from file. Syntax is similar to doxygen's
1096
- # config file, i.e. a series of assignments. You only have to provide
1097
- # replacements, missing definitions are set to their default value.
1098
-
1099
- RTF_STYLESHEET_FILE =
1100
-
1101
- # Set optional variables used in the generation of an rtf document.
1102
- # Syntax is similar to doxygen's config file.
1103
-
1104
- RTF_EXTENSIONS_FILE =
1105
-
1106
- #---------------------------------------------------------------------------
1107
- # configuration options related to the man page output
1108
- #---------------------------------------------------------------------------
1109
-
1110
- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will
1111
- # generate man pages
1112
-
1113
- GENERATE_MAN = NO
1114
-
1115
- # The MAN_OUTPUT tag is used to specify where the man pages will be put.
1116
- # If a relative path is entered the value of OUTPUT_DIRECTORY will be
1117
- # put in front of it. If left blank `man' will be used as the default path.
1118
-
1119
- MAN_OUTPUT = man
1120
-
1121
- # The MAN_EXTENSION tag determines the extension that is added to
1122
- # the generated man pages (default is the subroutine's section .3)
1123
-
1124
- MAN_EXTENSION = .3
1125
-
1126
- # If the MAN_LINKS tag is set to YES and Doxygen generates man output,
1127
- # then it will generate one additional man file for each entity
1128
- # documented in the real man page(s). These additional files
1129
- # only source the real man page, but without them the man command
1130
- # would be unable to find the correct page. The default is NO.
1131
-
1132
- MAN_LINKS = NO
1133
-
1134
- #---------------------------------------------------------------------------
1135
- # configuration options related to the XML output
1136
- #---------------------------------------------------------------------------
1137
-
1138
- # If the GENERATE_XML tag is set to YES Doxygen will
1139
- # generate an XML file that captures the structure of
1140
- # the code including all documentation.
1141
-
1142
- GENERATE_XML = NO
1143
-
1144
- # The XML_OUTPUT tag is used to specify where the XML pages will be put.
1145
- # If a relative path is entered the value of OUTPUT_DIRECTORY will be
1146
- # put in front of it. If left blank `xml' will be used as the default path.
1147
-
1148
- XML_OUTPUT = xml
1149
-
1150
- # The XML_SCHEMA tag can be used to specify an XML schema,
1151
- # which can be used by a validating XML parser to check the
1152
- # syntax of the XML files.
1153
-
1154
- XML_SCHEMA =
1155
-
1156
- # The XML_DTD tag can be used to specify an XML DTD,
1157
- # which can be used by a validating XML parser to check the
1158
- # syntax of the XML files.
1159
-
1160
- XML_DTD =
1161
-
1162
- # If the XML_PROGRAMLISTING tag is set to YES Doxygen will
1163
- # dump the program listings (including syntax highlighting
1164
- # and cross-referencing information) to the XML output. Note that
1165
- # enabling this will significantly increase the size of the XML output.
1166
-
1167
- XML_PROGRAMLISTING = YES
1168
-
1169
- #---------------------------------------------------------------------------
1170
- # configuration options for the AutoGen Definitions output
1171
- #---------------------------------------------------------------------------
1172
-
1173
- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
1174
- # generate an AutoGen Definitions (see autogen.sf.net) file
1175
- # that captures the structure of the code including all
1176
- # documentation. Note that this feature is still experimental
1177
- # and incomplete at the moment.
1178
-
1179
- GENERATE_AUTOGEN_DEF = NO
1180
-
1181
- #---------------------------------------------------------------------------
1182
- # configuration options related to the Perl module output
1183
- #---------------------------------------------------------------------------
1184
-
1185
- # If the GENERATE_PERLMOD tag is set to YES Doxygen will
1186
- # generate a Perl module file that captures the structure of
1187
- # the code including all documentation. Note that this
1188
- # feature is still experimental and incomplete at the
1189
- # moment.
1190
-
1191
- GENERATE_PERLMOD = NO
1192
-
1193
- # If the PERLMOD_LATEX tag is set to YES Doxygen will generate
1194
- # the necessary Makefile rules, Perl scripts and LaTeX code to be able
1195
- # to generate PDF and DVI output from the Perl module output.
1196
-
1197
- PERLMOD_LATEX = NO
1198
-
1199
- # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
1200
- # nicely formatted so it can be parsed by a human reader.
1201
- # This is useful
1202
- # if you want to understand what is going on.
1203
- # On the other hand, if this
1204
- # tag is set to NO the size of the Perl module output will be much smaller
1205
- # and Perl will parse it just the same.
1206
-
1207
- PERLMOD_PRETTY = YES
1208
-
1209
- # The names of the make variables in the generated doxyrules.make file
1210
- # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
1211
- # This is useful so different doxyrules.make files included by the same
1212
- # Makefile don't overwrite each other's variables.
1213
-
1214
- PERLMOD_MAKEVAR_PREFIX =
1215
-
1216
- #---------------------------------------------------------------------------
1217
- # Configuration options related to the preprocessor
1218
- #---------------------------------------------------------------------------
1219
-
1220
- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
1221
- # evaluate all C-preprocessor directives found in the sources and include
1222
- # files.
1223
-
1224
- ENABLE_PREPROCESSING = YES
1225
-
1226
- # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
1227
- # names in the source code. If set to NO (the default) only conditional
1228
- # compilation will be performed. Macro expansion can be done in a controlled
1229
- # way by setting EXPAND_ONLY_PREDEF to YES.
1230
-
1231
- MACRO_EXPANSION = NO
1232
-
1233
- # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
1234
- # then the macro expansion is limited to the macros specified with the
1235
- # PREDEFINED and EXPAND_AS_DEFINED tags.
1236
-
1237
- EXPAND_ONLY_PREDEF = NO
1238
-
1239
- # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
1240
- # in the INCLUDE_PATH (see below) will be search if a #include is found.
1241
-
1242
- SEARCH_INCLUDES = YES
1243
-
1244
- # The INCLUDE_PATH tag can be used to specify one or more directories that
1245
- # contain include files that are not input files but should be processed by
1246
- # the preprocessor.
1247
-
1248
- INCLUDE_PATH =
1249
-
1250
- # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
1251
- # patterns (like *.h and *.hpp) to filter out the header-files in the
1252
- # directories. If left blank, the patterns specified with FILE_PATTERNS will
1253
- # be used.
1254
-
1255
- INCLUDE_FILE_PATTERNS =
1256
-
1257
- # The PREDEFINED tag can be used to specify one or more macro names that
1258
- # are defined before the preprocessor is started (similar to the -D option of
1259
- # gcc). The argument of the tag is a list of macros of the form: name
1260
- # or name=definition (no spaces). If the definition and the = are
1261
- # omitted =1 is assumed. To prevent a macro definition from being
1262
- # undefined via #undef or recursively expanded use the := operator
1263
- # instead of the = operator.
1264
-
1265
- PREDEFINED =
1266
-
1267
- # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
1268
- # this tag can be used to specify a list of macro names that should be expanded.
1269
- # The macro definition that is found in the sources will be used.
1270
- # Use the PREDEFINED tag if you want to use a different macro definition.
1271
-
1272
- EXPAND_AS_DEFINED =
1273
-
1274
- # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
1275
- # doxygen's preprocessor will remove all function-like macros that are alone
1276
- # on a line, have an all uppercase name, and do not end with a semicolon. Such
1277
- # function macros are typically used for boiler-plate code, and will confuse
1278
- # the parser if not removed.
1279
-
1280
- SKIP_FUNCTION_MACROS = YES
1281
-
1282
- #---------------------------------------------------------------------------
1283
- # Configuration::additions related to external references
1284
- #---------------------------------------------------------------------------
1285
-
1286
- # The TAGFILES option can be used to specify one or more tagfiles.
1287
- # Optionally an initial location of the external documentation
1288
- # can be added for each tagfile. The format of a tag file without
1289
- # this location is as follows:
1290
- #
1291
- # TAGFILES = file1 file2 ...
1292
- # Adding location for the tag files is done as follows:
1293
- #
1294
- # TAGFILES = file1=loc1 "file2 = loc2" ...
1295
- # where "loc1" and "loc2" can be relative or absolute paths or
1296
- # URLs. If a location is present for each tag, the installdox tool
1297
- # does not have to be run to correct the links.
1298
- # Note that each tag file must have a unique name
1299
- # (where the name does NOT include the path)
1300
- # If a tag file is not located in the directory in which doxygen
1301
- # is run, you must also specify the path to the tagfile here.
1302
-
1303
- TAGFILES =
1304
-
1305
- # When a file name is specified after GENERATE_TAGFILE, doxygen will create
1306
- # a tag file that is based on the input files it reads.
1307
-
1308
- GENERATE_TAGFILE =
1309
-
1310
- # If the ALLEXTERNALS tag is set to YES all external classes will be listed
1311
- # in the class index. If set to NO only the inherited external classes
1312
- # will be listed.
1313
-
1314
- ALLEXTERNALS = NO
1315
-
1316
- # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
1317
- # in the modules index. If set to NO, only the current project's groups will
1318
- # be listed.
1319
-
1320
- EXTERNAL_GROUPS = YES
1321
-
1322
- # The PERL_PATH should be the absolute path and name of the perl script
1323
- # interpreter (i.e. the result of `which perl').
1324
-
1325
- PERL_PATH = /usr/bin/perl
1326
-
1327
- #---------------------------------------------------------------------------
1328
- # Configuration options related to the dot tool
1329
- #---------------------------------------------------------------------------
1330
-
1331
- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
1332
- # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
1333
- # or super classes. Setting the tag to NO turns the diagrams off. Note that
1334
- # this option is superseded by the HAVE_DOT option below. This is only a
1335
- # fallback. It is recommended to install and use dot, since it yields more
1336
- # powerful graphs.
1337
-
1338
- CLASS_DIAGRAMS = YES
1339
-
1340
- # You can define message sequence charts within doxygen comments using the \msc
1341
- # command. Doxygen will then run the mscgen tool (see
1342
- # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
1343
- # documentation. The MSCGEN_PATH tag allows you to specify the directory where
1344
- # the mscgen tool resides. If left empty the tool is assumed to be found in the
1345
- # default search path.
1346
-
1347
- MSCGEN_PATH =
1348
-
1349
- # If set to YES, the inheritance and collaboration graphs will hide
1350
- # inheritance and usage relations if the target is undocumented
1351
- # or is not a class.
1352
-
1353
- HIDE_UNDOC_RELATIONS = YES
1354
-
1355
- # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
1356
- # available from the path. This tool is part of Graphviz, a graph visualization
1357
- # toolkit from AT&T and Lucent Bell Labs. The other options in this section
1358
- # have no effect if this option is set to NO (the default)
1359
-
1360
- HAVE_DOT = NO
1361
-
1362
- # By default doxygen will write a font called FreeSans.ttf to the output
1363
- # directory and reference it in all dot files that doxygen generates. This
1364
- # font does not include all possible unicode characters however, so when you need
1365
- # these (or just want a differently looking font) you can specify the font name
1366
- # using DOT_FONTNAME. You need need to make sure dot is able to find the font,
1367
- # which can be done by putting it in a standard location or by setting the
1368
- # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
1369
- # containing the font.
1370
-
1371
- DOT_FONTNAME = FreeSans
1372
-
1373
- # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
1374
- # The default size is 10pt.
1375
-
1376
- DOT_FONTSIZE = 10
1377
-
1378
- # By default doxygen will tell dot to use the output directory to look for the
1379
- # FreeSans.ttf font (which doxygen will put there itself). If you specify a
1380
- # different font using DOT_FONTNAME you can set the path where dot
1381
- # can find it using this tag.
1382
-
1383
- DOT_FONTPATH =
1384
-
1385
- # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
1386
- # will generate a graph for each documented class showing the direct and
1387
- # indirect inheritance relations. Setting this tag to YES will force the
1388
- # the CLASS_DIAGRAMS tag to NO.
1389
-
1390
- CLASS_GRAPH = YES
1391
-
1392
- # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
1393
- # will generate a graph for each documented class showing the direct and
1394
- # indirect implementation dependencies (inheritance, containment, and
1395
- # class references variables) of the class with other documented classes.
1396
-
1397
- COLLABORATION_GRAPH = YES
1398
-
1399
- # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
1400
- # will generate a graph for groups, showing the direct groups dependencies
1401
-
1402
- GROUP_GRAPHS = YES
1403
-
1404
- # If the UML_LOOK tag is set to YES doxygen will generate inheritance and
1405
- # collaboration diagrams in a style similar to the OMG's Unified Modeling
1406
- # Language.
1407
-
1408
- UML_LOOK = NO
1409
-
1410
- # If set to YES, the inheritance and collaboration graphs will show the
1411
- # relations between templates and their instances.
1412
-
1413
- TEMPLATE_RELATIONS = NO
1414
-
1415
- # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
1416
- # tags are set to YES then doxygen will generate a graph for each documented
1417
- # file showing the direct and indirect include dependencies of the file with
1418
- # other documented files.
1419
-
1420
- INCLUDE_GRAPH = YES
1421
-
1422
- # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
1423
- # HAVE_DOT tags are set to YES then doxygen will generate a graph for each
1424
- # documented header file showing the documented files that directly or
1425
- # indirectly include this file.
1426
-
1427
- INCLUDED_BY_GRAPH = YES
1428
-
1429
- # If the CALL_GRAPH and HAVE_DOT options are set to YES then
1430
- # doxygen will generate a call dependency graph for every global function
1431
- # or class method. Note that enabling this option will significantly increase
1432
- # the time of a run. So in most cases it will be better to enable call graphs
1433
- # for selected functions only using the \callgraph command.
1434
-
1435
- CALL_GRAPH = NO
1436
-
1437
- # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
1438
- # doxygen will generate a caller dependency graph for every global function
1439
- # or class method. Note that enabling this option will significantly increase
1440
- # the time of a run. So in most cases it will be better to enable caller
1441
- # graphs for selected functions only using the \callergraph command.
1442
-
1443
- CALLER_GRAPH = NO
1444
-
1445
- # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
1446
- # will graphical hierarchy of all classes instead of a textual one.
1447
-
1448
- GRAPHICAL_HIERARCHY = YES
1449
-
1450
- # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
1451
- # then doxygen will show the dependencies a directory has on other directories
1452
- # in a graphical way. The dependency relations are determined by the #include
1453
- # relations between the files in the directories.
1454
-
1455
- DIRECTORY_GRAPH = YES
1456
-
1457
- # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
1458
- # generated by dot. Possible values are png, jpg, or gif
1459
- # If left blank png will be used.
1460
-
1461
- DOT_IMAGE_FORMAT = png
1462
-
1463
- # The tag DOT_PATH can be used to specify the path where the dot tool can be
1464
- # found. If left blank, it is assumed the dot tool can be found in the path.
1465
-
1466
- DOT_PATH =
1467
-
1468
- # The DOTFILE_DIRS tag can be used to specify one or more directories that
1469
- # contain dot files that are included in the documentation (see the
1470
- # \dotfile command).
1471
-
1472
- DOTFILE_DIRS =
1473
-
1474
- # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
1475
- # nodes that will be shown in the graph. If the number of nodes in a graph
1476
- # becomes larger than this value, doxygen will truncate the graph, which is
1477
- # visualized by representing a node as a red box. Note that doxygen if the
1478
- # number of direct children of the root node in a graph is already larger than
1479
- # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
1480
- # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
1481
-
1482
- DOT_GRAPH_MAX_NODES = 50
1483
-
1484
- # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
1485
- # graphs generated by dot. A depth value of 3 means that only nodes reachable
1486
- # from the root by following a path via at most 3 edges will be shown. Nodes
1487
- # that lay further from the root node will be omitted. Note that setting this
1488
- # option to 1 or 2 may greatly reduce the computation time needed for large
1489
- # code bases. Also note that the size of a graph can be further restricted by
1490
- # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
1491
-
1492
- MAX_DOT_GRAPH_DEPTH = 0
1493
-
1494
- # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
1495
- # background. This is disabled by default, because dot on Windows does not
1496
- # seem to support this out of the box. Warning: Depending on the platform used,
1497
- # enabling this option may lead to badly anti-aliased labels on the edges of
1498
- # a graph (i.e. they become hard to read).
1499
-
1500
- DOT_TRANSPARENT = NO
1501
-
1502
- # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
1503
- # files in one run (i.e. multiple -o and -T options on the command line). This
1504
- # makes dot run faster, but since only newer versions of dot (>1.8.10)
1505
- # support this, this feature is disabled by default.
1506
-
1507
- DOT_MULTI_TARGETS = NO
1508
-
1509
- # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
1510
- # generate a legend page explaining the meaning of the various boxes and
1511
- # arrows in the dot generated graphs.
1512
-
1513
- GENERATE_LEGEND = YES
1514
-
1515
- # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
1516
- # remove the intermediate dot files that are used to generate
1517
- # the various graphs.
1518
-
1519
- DOT_CLEANUP = YES
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/GIT_REVISION DELETED
@@ -1 +0,0 @@
1
- 1f054617eca14eae921e987b4b4eeb2b1d91de6b
 
 
kenlm/LICENSE DELETED
@@ -1,25 +0,0 @@
1
- Most of the code here is licensed under the LGPL. There are exceptions that
2
- have their own licenses, listed below. See comments in those files for more
3
- details.
4
-
5
- util/getopt.* is getopt for Windows
6
- util/murmur_hash.cc
7
- util/string_piece.hh and util/string_piece.cc
8
- util/double-conversion/LICENSE covers util/double-conversion except the build files
9
- util/file.cc contains a modified implementation of mkstemp under the LGPL
10
- util/integer_to_string.* is BSD
11
-
12
- For the rest:
13
-
14
- KenLM is free software: you can redistribute it and/or modify
15
- it under the terms of the GNU Lesser General Public License as published
16
- by the Free Software Foundation, either version 2.1 of the License, or
17
- (at your option) any later version.
18
-
19
- KenLM is distributed in the hope that it will be useful,
20
- but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- GNU Lesser General Public License for more details.
23
-
24
- You should have received a copy of the GNU Lesser General Public License 2.1
25
- along with KenLM code. If not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/MANIFEST.in DELETED
@@ -1,9 +0,0 @@
1
- # file GENERATED by distutils, do NOT edit
2
- include setup.py
3
- include lm/*.cc
4
- include lm/*.hh
5
- include python/*.cpp
6
- include util/*.cc
7
- include util/*.hh
8
- include util/double-conversion/*.cc
9
- include util/double-conversion/*.h
 
 
 
 
 
 
 
 
 
 
kenlm/README.md DELETED
@@ -1,102 +0,0 @@
1
- # kenlm
2
-
3
- Language model inference code by Kenneth Heafield (kenlm at kheafield.com)
4
-
5
- The website https://kheafield.com/code/kenlm/ has more documentation. If you're a decoder developer, please download the latest version from there instead of copying from another decoder.
6
-
7
- ## Compiling
8
- Use cmake, see [BUILDING](BUILDING) for build dependencies and more detail.
9
- ```bash
10
- mkdir -p build
11
- cd build
12
- cmake ..
13
- make -j 4
14
- ```
15
-
16
- ## Compiling with your own build system
17
- If you want to compile with your own build system (Makefile etc) or to use as a library, there are a number of macros you can set on the g++ command line or in util/have.hh .
18
-
19
- * `KENLM_MAX_ORDER` is the maximum order that can be loaded. This is done to make state an efficient POD rather than a vector.
20
- * `HAVE_ICU` If your code links against ICU, define this to disable the internal StringPiece and replace it with ICU's copy of StringPiece, avoiding naming conflicts.
21
-
22
- ARPA files can be read in compressed format with these options:
23
- * `HAVE_ZLIB` Supports gzip. Link with -lz.
24
- * `HAVE_BZLIB` Supports bzip2. Link with -lbz2.
25
- * `HAVE_XZLIB` Supports xz. Link with -llzma.
26
-
27
- Note that these macros impact only `read_compressed.cc` and `read_compressed_test.cc`. The bjam build system will auto-detect bzip2 and xz support.
28
-
29
- ## Estimation
30
- lmplz estimates unpruned language models with modified Kneser-Ney smoothing. After compiling with bjam, run
31
- ```bash
32
- bin/lmplz -o 5 <text >text.arpa
33
- ```
34
- The algorithm is on-disk, using an amount of memory that you specify. See https://kheafield.com/code/kenlm/estimation/ for more.
35
-
36
- MT Marathon 2012 team members Ivan Pouzyrevsky and Mohammed Mediani contributed to the computation design and early implementation. Jon Clark contributed to the design, clarified points about smoothing, and added logging.
37
-
38
- ## Filtering
39
-
40
- filter takes an ARPA or count file and removes entries that will never be queried. The filter criterion can be corpus-level vocabulary, sentence-level vocabulary, or sentence-level phrases. Run
41
- ```bash
42
- bin/filter
43
- ```
44
- and see https://kheafield.com/code/kenlm/filter/ for more documentation.
45
-
46
- ## Querying
47
-
48
- Two data structures are supported: probing and trie. Probing is a probing hash table with keys that are 64-bit hashes of n-grams and floats as values. Trie is a fairly standard trie but with bit-level packing so it uses the minimum number of bits to store word indices and pointers. The trie node entries are sorted by word index. Probing is the fastest and uses the most memory. Trie uses the least memory and is a bit slower.
49
-
50
- As is the custom in language modeling, all probabilities are log base 10.
51
-
52
- With trie, resident memory is 58% of IRST's smallest version and 21% of SRI's compact version. Simultaneously, trie CPU's use is 81% of IRST's fastest version and 84% of SRI's fast version. KenLM's probing hash table implementation goes even faster at the expense of using more memory. See https://kheafield.com/code/kenlm/benchmark/.
53
-
54
- Binary format via mmap is supported. Run `./build_binary` to make one then pass the binary file name to the appropriate Model constructor.
55
-
56
- ## Platforms
57
- `murmur_hash.cc` and `bit_packing.hh` perform unaligned reads and writes that make the code architecture-dependent.
58
- It has been sucessfully tested on x86\_64, x86, and PPC64.
59
- ARM support is reportedly working, at least on the iphone.
60
-
61
- Runs on Linux, OS X, Cygwin, and MinGW.
62
-
63
- Hideo Okuma and Tomoyuki Yoshimura from NICT contributed ports to ARM and MinGW.
64
-
65
- ## Decoder developers
66
- - I recommend copying the code and distributing it with your decoder. However, please send improvements upstream.
67
-
68
- - It's possible to compile the query-only code without Boost, but useful things like estimating models require Boost.
69
-
70
- - Select the macros you want, listed in the previous section.
71
-
72
- - There are two build systems: compile.sh and cmake. They're pretty simple and are intended to be reimplemented in your build system.
73
-
74
- - Use either the interface in `lm/model.hh` or `lm/virtual_interface.hh`. Interface documentation is in comments of `lm/virtual_interface.hh` and `lm/model.hh`.
75
-
76
- - There are several possible data structures in `model.hh`. Use `RecognizeBinary` in `binary_format.hh` to determine which one a user has provided. You probably already implement feature functions as an abstract virtual base class with several children. I suggest you co-opt this existing virtual dispatch by templatizing the language model feature implementation on the KenLM model identified by `RecognizeBinary`. This is the strategy used in Moses and cdec.
77
-
78
- - See `lm/config.hh` for run-time tuning options.
79
-
80
- ## Contributors
81
- Contributions to KenLM are welcome. Please base your contributions on https://github.com/kpu/kenlm and send pull requests (or I might give you commit access). Downstream copies in Moses and cdec are maintained by overwriting them so do not make changes there.
82
-
83
- ## Python module
84
- Contributed by Victor Chahuneau.
85
-
86
- ### Installation
87
-
88
- ```bash
89
- pip install https://github.com/kpu/kenlm/archive/master.zip
90
- ```
91
-
92
- ### Basic Usage
93
- ```python
94
- import kenlm
95
- model = kenlm.Model('lm/test.arpa')
96
- print(model.score('this is a sentence .', bos = True, eos = True))
97
- ```
98
- See [python/example.py](python/example.py) and [python/kenlm.pyx](python/kenlm.pyx) for more, including stateful APIs.
99
-
100
- ---
101
-
102
- The name was Hieu Hoang's idea, not mine.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/clean_query_only.sh DELETED
@@ -1,2 +0,0 @@
1
- #!/bin/bash
2
- rm -rf {lm,util,util/double-conversion}/*.o bin/{query,build_binary}
 
 
 
kenlm/cmake/KenLMFunctions.cmake DELETED
@@ -1,81 +0,0 @@
1
- # Helper functions used across the CMake build system
2
-
3
- include(CMakeParseArguments)
4
-
5
- # Adds a bunch of executables to the build, each depending on the specified
6
- # dependent object files and linking against the specified libraries
7
- function(AddExes)
8
- set(multiValueArgs EXES DEPENDS LIBRARIES)
9
- cmake_parse_arguments(AddExes "" "" "${multiValueArgs}" ${ARGN})
10
-
11
- # Iterate through the executable list
12
- foreach(exe ${AddExes_EXES})
13
-
14
- # Compile the executable, linking against the requisite dependent object files
15
- add_executable(${exe} ${exe}_main.cc ${AddExes_DEPENDS})
16
-
17
- # Link the executable against the supplied libraries
18
- target_link_libraries(${exe} ${AddExes_LIBRARIES})
19
-
20
- # Group executables together
21
- set_target_properties(${exe} PROPERTIES FOLDER executables)
22
-
23
- # End for loop
24
- endforeach(exe)
25
-
26
- # Install the executable files
27
- install(TARGETS ${AddExes_EXES} DESTINATION bin)
28
- endfunction()
29
-
30
- # Adds a single test to the build, depending on the specified dependent
31
- # object files, linking against the specified libraries, and with the
32
- # specified command line arguments
33
- function(KenLMAddTest)
34
- cmake_parse_arguments(KenLMAddTest "" "TEST"
35
- "DEPENDS;LIBRARIES;TEST_ARGS" ${ARGN})
36
-
37
- # Compile the executable, linking against the requisite dependent object files
38
- add_executable(${KenLMAddTest_TEST}
39
- ${KenLMAddTest_TEST}.cc
40
- ${KenLMAddTest_DEPENDS})
41
-
42
- if (Boost_USE_STATIC_LIBS)
43
- set(DYNLINK_FLAGS)
44
- else()
45
- set(DYNLINK_FLAGS COMPILE_FLAGS -DBOOST_TEST_DYN_LINK)
46
- endif()
47
-
48
- # Require the following compile flag
49
- set_target_properties(${KenLMAddTest_TEST} PROPERTIES
50
- ${DYNLINK_FLAGS}
51
- RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/tests)
52
-
53
- target_link_libraries(${KenLMAddTest_TEST} ${KenLMAddTest_LIBRARIES} ${TIMER_LINK})
54
-
55
- set(test_params "")
56
- if(KenLMAddTest_TEST_ARGS)
57
- set(test_params ${KenLMAddTest_TEST_ARGS})
58
- endif()
59
-
60
- # Specify command arguments for how to run each unit test
61
- add_test(NAME ${KenLMAddTest_TEST}
62
- COMMAND ${KenLMAddTest_TEST} ${test_params})
63
-
64
- # Group unit tests together
65
- set_target_properties(${KenLMAddTest_TEST} PROPERTIES FOLDER "unit_tests")
66
- endfunction()
67
-
68
- # Adds a bunch of tests to the build, each depending on the specified
69
- # dependent object files and linking against the specified libraries
70
- function(AddTests)
71
- set(multiValueArgs TESTS DEPENDS LIBRARIES TEST_ARGS)
72
- cmake_parse_arguments(AddTests "" "" "${multiValueArgs}" ${ARGN})
73
-
74
- # Iterate through the Boost tests list
75
- foreach(test ${AddTests_TESTS})
76
- KenLMAddTest(TEST ${test}
77
- DEPENDS ${AddTests_DEPENDS}
78
- LIBRARIES ${AddTests_LIBRARIES}
79
- TEST_ARGS ${AddTests_TEST_ARGS})
80
- endforeach(test)
81
- endfunction()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/cmake/modules/FindEigen3.cmake DELETED
@@ -1,90 +0,0 @@
1
- # - Try to find Eigen3 lib
2
- #
3
- # This module supports requiring a minimum version, e.g. you can do
4
- # find_package(Eigen3 3.1.2)
5
- # to require version 3.1.2 or newer of Eigen3.
6
- #
7
- # Once done this will define
8
- #
9
- # EIGEN3_FOUND - system has eigen lib with correct version
10
- # EIGEN3_INCLUDE_DIR - the eigen include directory
11
- # EIGEN3_VERSION - eigen version
12
- #
13
- # This module reads hints about search locations from
14
- # the following enviroment variables:
15
- #
16
- # EIGEN3_ROOT
17
- # EIGEN3_ROOT_DIR
18
-
19
- # Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
20
- # Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
21
- # Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
22
- # Redistribution and use is allowed according to the terms of the 2-clause BSD license.
23
-
24
- if(NOT Eigen3_FIND_VERSION)
25
- if(NOT Eigen3_FIND_VERSION_MAJOR)
26
- set(Eigen3_FIND_VERSION_MAJOR 2)
27
- endif(NOT Eigen3_FIND_VERSION_MAJOR)
28
- if(NOT Eigen3_FIND_VERSION_MINOR)
29
- set(Eigen3_FIND_VERSION_MINOR 91)
30
- endif(NOT Eigen3_FIND_VERSION_MINOR)
31
- if(NOT Eigen3_FIND_VERSION_PATCH)
32
- set(Eigen3_FIND_VERSION_PATCH 0)
33
- endif(NOT Eigen3_FIND_VERSION_PATCH)
34
-
35
- set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
36
- endif(NOT Eigen3_FIND_VERSION)
37
-
38
- macro(_eigen3_check_version)
39
- file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
40
-
41
- string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
42
- set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
43
- string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
44
- set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
45
- string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
46
- set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
47
-
48
- set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
49
- if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
50
- set(EIGEN3_VERSION_OK FALSE)
51
- else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
52
- set(EIGEN3_VERSION_OK TRUE)
53
- endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
54
-
55
- if(NOT EIGEN3_VERSION_OK)
56
-
57
- message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
58
- "but at least version ${Eigen3_FIND_VERSION} is required")
59
- endif(NOT EIGEN3_VERSION_OK)
60
- endmacro(_eigen3_check_version)
61
-
62
- if (EIGEN3_INCLUDE_DIR)
63
-
64
- # in cache already
65
- _eigen3_check_version()
66
- set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
67
-
68
- else (EIGEN3_INCLUDE_DIR)
69
-
70
- find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
71
- HINTS
72
- ENV EIGEN3_ROOT
73
- ENV EIGEN3_ROOT_DIR
74
- PATHS
75
- ${CMAKE_INSTALL_PREFIX}/include
76
- ${KDE4_INCLUDE_DIR}
77
- PATH_SUFFIXES eigen3 eigen
78
- )
79
-
80
- if(EIGEN3_INCLUDE_DIR)
81
- _eigen3_check_version()
82
- endif(EIGEN3_INCLUDE_DIR)
83
-
84
- include(FindPackageHandleStandardArgs)
85
- find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
86
-
87
- mark_as_advanced(EIGEN3_INCLUDE_DIR)
88
-
89
- endif(EIGEN3_INCLUDE_DIR)
90
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/compile_query_only.sh DELETED
@@ -1,34 +0,0 @@
1
- #!/bin/bash
2
- #This is just an example compilation. You should integrate these files into your build system. Boost jam is provided and preferred.
3
-
4
- echo You must use ./bjam if you want language model estimation, filtering, or support for compressed files \(.gz, .bz2, .xz\) 1>&2
5
-
6
- rm {lm,util}/*.o 2>/dev/null
7
- set -e
8
-
9
- CXX=${CXX:-g++}
10
-
11
- CXXFLAGS+=" -I. -O3 -DNDEBUG -DKENLM_MAX_ORDER=6"
12
-
13
- #If this fails for you, consider using bjam.
14
- if [ ${#NPLM} != 0 ]; then
15
- CXXFLAGS+=" -DHAVE_NPLM -lneuralLM -L$NPLM/src -I$NPLM/src -lboost_thread-mt -fopenmp"
16
- ADDED_PATHS="lm/wrappers/*.cc"
17
- fi
18
- echo 'Compiling with '$CXX $CXXFLAGS
19
-
20
- #Grab all cc files in these directories except those ending in test.cc or main.cc
21
- objects=""
22
- for i in util/double-conversion/*.cc util/*.cc lm/*.cc $ADDED_PATHS; do
23
- if [ "${i%test.cc}" == "$i" ] && [ "${i%main.cc}" == "$i" ]; then
24
- $CXX $CXXFLAGS -c $i -o ${i%.cc}.o
25
- objects="$objects ${i%.cc}.o"
26
- fi
27
- done
28
-
29
- mkdir -p bin
30
- if [ "$(uname)" != Darwin ]; then
31
- CXXFLAGS="$CXXFLAGS -lrt"
32
- fi
33
- $CXX lm/build_binary_main.cc $objects -o bin/build_binary $CXXFLAGS $LDFLAGS
34
- $CXX lm/query_main.cc $objects -o bin/query $CXXFLAGS $LDFLAGS
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/bhiksha.hh DELETED
@@ -1,123 +0,0 @@
1
- /* Simple implementation of
2
- * @inproceedings{bhikshacompression,
3
- * author={Bhiksha Raj and Ed Whittaker},
4
- * year={2003},
5
- * title={Lossless Compression of Language Model Structure and Word Identifiers},
6
- * booktitle={Proceedings of IEEE International Conference on Acoustics, Speech and Signal Processing},
7
- * pages={388--391},
8
- * }
9
- *
10
- * Currently only used for next pointers.
11
- */
12
-
13
- #ifndef LM_BHIKSHA_H
14
- #define LM_BHIKSHA_H
15
-
16
- #include "lm/model_type.hh"
17
- #include "lm/trie.hh"
18
- #include "util/bit_packing.hh"
19
- #include "util/sorted_uniform.hh"
20
-
21
- #include <algorithm>
22
-
23
- #include <stdint.h>
24
- #include <assert.h>
25
-
26
- namespace lm {
27
- namespace ngram {
28
- struct Config;
29
- class BinaryFormat;
30
-
31
- namespace trie {
32
-
33
- class DontBhiksha {
34
- public:
35
- static const ModelType kModelTypeAdd = static_cast<ModelType>(0);
36
-
37
- static void UpdateConfigFromBinary(const BinaryFormat &, uint64_t, Config &/*config*/) {}
38
-
39
- static uint64_t Size(uint64_t /*max_offset*/, uint64_t /*max_next*/, const Config &/*config*/) { return 0; }
40
-
41
- static uint8_t InlineBits(uint64_t /*max_offset*/, uint64_t max_next, const Config &/*config*/) {
42
- return util::RequiredBits(max_next);
43
- }
44
-
45
- DontBhiksha(const void *base, uint64_t max_offset, uint64_t max_next, const Config &config);
46
-
47
- void ReadNext(const void *base, uint64_t bit_offset, uint64_t /*index*/, uint8_t total_bits, NodeRange &out) const {
48
- out.begin = util::ReadInt57(base, bit_offset, next_.bits, next_.mask);
49
- out.end = util::ReadInt57(base, bit_offset + total_bits, next_.bits, next_.mask);
50
- //assert(out.end >= out.begin);
51
- }
52
-
53
- void WriteNext(void *base, uint64_t bit_offset, uint64_t /*index*/, uint64_t value) {
54
- util::WriteInt57(base, bit_offset, next_.bits, value);
55
- }
56
-
57
- void FinishedLoading(const Config &/*config*/) {}
58
-
59
- uint8_t InlineBits() const { return next_.bits; }
60
-
61
- private:
62
- util::BitsMask next_;
63
- };
64
-
65
- class ArrayBhiksha {
66
- public:
67
- static const ModelType kModelTypeAdd = kArrayAdd;
68
-
69
- static void UpdateConfigFromBinary(const BinaryFormat &file, uint64_t offset, Config &config);
70
-
71
- static uint64_t Size(uint64_t max_offset, uint64_t max_next, const Config &config);
72
-
73
- static uint8_t InlineBits(uint64_t max_offset, uint64_t max_next, const Config &config);
74
-
75
- ArrayBhiksha(void *base, uint64_t max_offset, uint64_t max_value, const Config &config);
76
-
77
- void ReadNext(const void *base, uint64_t bit_offset, uint64_t index, uint8_t total_bits, NodeRange &out) const {
78
- // Some assertions are commented out because they are expensive.
79
- // assert(*offset_begin_ == 0);
80
- // std::upper_bound returns the first element that is greater. Want the
81
- // last element that is <= to the index.
82
- const uint64_t *begin_it = std::upper_bound(offset_begin_, offset_end_, index) - 1;
83
- // Since *offset_begin_ == 0, the position should be in range.
84
- // assert(begin_it >= offset_begin_);
85
- const uint64_t *end_it;
86
- for (end_it = begin_it + 1; (end_it < offset_end_) && (*end_it <= index + 1); ++end_it) {}
87
- // assert(end_it == std::upper_bound(offset_begin_, offset_end_, index + 1));
88
- --end_it;
89
- // assert(end_it >= begin_it);
90
- out.begin = ((begin_it - offset_begin_) << next_inline_.bits) |
91
- util::ReadInt57(base, bit_offset, next_inline_.bits, next_inline_.mask);
92
- out.end = ((end_it - offset_begin_) << next_inline_.bits) |
93
- util::ReadInt57(base, bit_offset + total_bits, next_inline_.bits, next_inline_.mask);
94
- // If this fails, consider rebuilding your model using KenLM after 1e333d786b748555e8f368d2bbba29a016c98052
95
- assert(out.end >= out.begin);
96
- }
97
-
98
- void WriteNext(void *base, uint64_t bit_offset, uint64_t index, uint64_t value) {
99
- uint64_t encode = value >> next_inline_.bits;
100
- for (; write_to_ <= offset_begin_ + encode; ++write_to_) *write_to_ = index;
101
- util::WriteInt57(base, bit_offset, next_inline_.bits, value & next_inline_.mask);
102
- }
103
-
104
- void FinishedLoading(const Config &config);
105
-
106
- uint8_t InlineBits() const { return next_inline_.bits; }
107
-
108
- private:
109
- const util::BitsMask next_inline_;
110
-
111
- const uint64_t *const offset_begin_;
112
- const uint64_t *const offset_end_;
113
-
114
- uint64_t *write_to_;
115
-
116
- void *original_base_;
117
- };
118
-
119
- } // namespace trie
120
- } // namespace ngram
121
- } // namespace lm
122
-
123
- #endif // LM_BHIKSHA_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/binary_format.hh DELETED
@@ -1,106 +0,0 @@
1
- #ifndef LM_BINARY_FORMAT_H
2
- #define LM_BINARY_FORMAT_H
3
-
4
- #include "lm/config.hh"
5
- #include "lm/model_type.hh"
6
- #include "lm/read_arpa.hh"
7
-
8
- #include "util/file_piece.hh"
9
- #include "util/mmap.hh"
10
- #include "util/scoped.hh"
11
-
12
- #include <cstddef>
13
- #include <vector>
14
-
15
- #include <stdint.h>
16
-
17
- namespace lm {
18
- namespace ngram {
19
-
20
- extern const char *kModelNames[6];
21
-
22
- /*Inspect a file to determine if it is a binary lm. If not, return false.
23
- * If so, return true and set recognized to the type. This is the only API in
24
- * this header designed for use by decoder authors.
25
- */
26
- bool RecognizeBinary(const char *file, ModelType &recognized);
27
-
28
- struct FixedWidthParameters {
29
- unsigned char order;
30
- float probing_multiplier;
31
- // What type of model is this?
32
- ModelType model_type;
33
- // Does the end of the file have the actual strings in the vocabulary?
34
- bool has_vocabulary;
35
- unsigned int search_version;
36
- };
37
-
38
- // This is a macro instead of an inline function so constants can be assigned using it.
39
- #define ALIGN8(a) ((std::ptrdiff_t(((a)-1)/8)+1)*8)
40
-
41
- // Parameters stored in the header of a binary file.
42
- struct Parameters {
43
- FixedWidthParameters fixed;
44
- std::vector<uint64_t> counts;
45
- };
46
-
47
- class BinaryFormat {
48
- public:
49
- explicit BinaryFormat(const Config &config);
50
-
51
- // Reading a binary file:
52
- // Takes ownership of fd
53
- void InitializeBinary(int fd, ModelType model_type, unsigned int search_version, Parameters &params);
54
- // Used to read parts of the file to update the config object before figuring out full size.
55
- void ReadForConfig(void *to, std::size_t amount, uint64_t offset_excluding_header) const;
56
- // Actually load the binary file and return a pointer to the beginning of the search area.
57
- void *LoadBinary(std::size_t size);
58
-
59
- uint64_t VocabStringReadingOffset() const {
60
- assert(vocab_string_offset_ != kInvalidOffset);
61
- return vocab_string_offset_;
62
- }
63
-
64
- // Writing a binary file or initializing in RAM from ARPA:
65
- // Size for vocabulary.
66
- void *SetupJustVocab(std::size_t memory_size, uint8_t order);
67
- // Warning: can change the vocaulary base pointer.
68
- void *GrowForSearch(std::size_t memory_size, std::size_t vocab_pad, void *&vocab_base);
69
- // Warning: can change vocabulary and search base addresses.
70
- void WriteVocabWords(const std::string &buffer, void *&vocab_base, void *&search_base);
71
- // Write the header at the beginning of the file.
72
- void FinishFile(const Config &config, ModelType model_type, unsigned int search_version, const std::vector<uint64_t> &counts);
73
-
74
- private:
75
- void MapFile(void *&vocab_base, void *&search_base);
76
-
77
- // Copied from configuration.
78
- const Config::WriteMethod write_method_;
79
- const char *write_mmap_;
80
- util::LoadMethod load_method_;
81
-
82
- // File behind memory, if any.
83
- util::scoped_fd file_;
84
-
85
- // If there is a file involved, a single mapping.
86
- util::scoped_memory mapping_;
87
-
88
- // If the data is only in memory, separately allocate each because the trie
89
- // knows vocab's size before it knows search's size (because SRILM might
90
- // have pruned).
91
- util::scoped_memory memory_vocab_, memory_search_;
92
-
93
- // Memory ranges. Note that these may not be contiguous and may not all
94
- // exist.
95
- std::size_t header_size_, vocab_size_, vocab_pad_;
96
- // aka end of search.
97
- uint64_t vocab_string_offset_;
98
-
99
- static const uint64_t kInvalidOffset = (uint64_t)-1;
100
- };
101
-
102
- bool IsBinaryFormat(int fd);
103
-
104
- } // namespace ngram
105
- } // namespace lm
106
- #endif // LM_BINARY_FORMAT_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/blank.hh DELETED
@@ -1,43 +0,0 @@
1
- #ifndef LM_BLANK_H
2
- #define LM_BLANK_H
3
-
4
- #include <limits>
5
-
6
- #include <stdint.h>
7
- #include <math.h>
8
-
9
- namespace lm {
10
- namespace ngram {
11
-
12
- /* Suppose "foo bar" appears with zero backoff but there is no trigram
13
- * beginning with these words. Then, when scoring "foo bar", the model could
14
- * return out_state containing "bar" or even null context if "bar" also has no
15
- * backoff and is never followed by another word. Then the backoff is set to
16
- * kNoExtensionBackoff. If the n-gram might be extended, then out_state must
17
- * contain the full n-gram, in which case kExtensionBackoff is set. In any
18
- * case, if an n-gram has non-zero backoff, the full state is returned so
19
- * backoff can be properly charged.
20
- * These differ only in sign bit because the backoff is in fact zero in either
21
- * case.
22
- */
23
- const float kNoExtensionBackoff = -0.0;
24
- const float kExtensionBackoff = 0.0;
25
- const uint64_t kNoExtensionQuant = 0;
26
- const uint64_t kExtensionQuant = 1;
27
-
28
- inline void SetExtension(float &backoff) {
29
- if (backoff == kNoExtensionBackoff) backoff = kExtensionBackoff;
30
- }
31
-
32
- // This compiles down nicely.
33
- inline bool HasExtension(const float &backoff) {
34
- typedef union { float f; uint32_t i; } UnionValue;
35
- UnionValue compare, interpret;
36
- compare.f = kNoExtensionBackoff;
37
- interpret.f = backoff;
38
- return compare.i != interpret.i;
39
- }
40
-
41
- } // namespace ngram
42
- } // namespace lm
43
- #endif // LM_BLANK_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/builder/adjust_counts.hh DELETED
@@ -1,72 +0,0 @@
1
- #ifndef LM_BUILDER_ADJUST_COUNTS_H
2
- #define LM_BUILDER_ADJUST_COUNTS_H
3
-
4
- #include "lm/builder/discount.hh"
5
- #include "lm/lm_exception.hh"
6
- #include "util/exception.hh"
7
-
8
- #include <vector>
9
-
10
- #include <stdint.h>
11
-
12
- namespace util { namespace stream { class ChainPositions; } }
13
-
14
- namespace lm {
15
- namespace builder {
16
-
17
- class BadDiscountException : public util::Exception {
18
- public:
19
- BadDiscountException() throw();
20
- ~BadDiscountException() throw();
21
- };
22
-
23
- struct DiscountConfig {
24
- // Overrides discounts for orders [1,discount_override.size()].
25
- std::vector<Discount> overwrite;
26
- // If discounting fails for an order, copy them from here.
27
- Discount fallback;
28
- // What to do when discounts are out of range or would trigger divison by
29
- // zero. It it does something other than THROW_UP, use fallback_discount.
30
- WarningAction bad_action;
31
- };
32
-
33
- /* Compute adjusted counts.
34
- * Input: unique suffix sorted N-grams (and just the N-grams) with raw counts.
35
- * Output: [1,N]-grams with adjusted counts.
36
- * [1,N)-grams are in suffix order
37
- * N-grams are in undefined order (they're going to be sorted anyway).
38
- */
39
- class AdjustCounts {
40
- public:
41
- // counts: output
42
- // counts_pruned: output
43
- // discounts: mostly output. If the input already has entries, they will be kept.
44
- // prune_thresholds: input. n-grams with normal (not adjusted) count below this will be pruned.
45
- AdjustCounts(
46
- const std::vector<uint64_t> &prune_thresholds,
47
- std::vector<uint64_t> &counts,
48
- std::vector<uint64_t> &counts_pruned,
49
- const std::vector<bool> &prune_words,
50
- const DiscountConfig &discount_config,
51
- std::vector<Discount> &discounts)
52
- : prune_thresholds_(prune_thresholds), counts_(counts), counts_pruned_(counts_pruned),
53
- prune_words_(prune_words), discount_config_(discount_config), discounts_(discounts)
54
- {}
55
-
56
- void Run(const util::stream::ChainPositions &positions);
57
-
58
- private:
59
- const std::vector<uint64_t> &prune_thresholds_;
60
- std::vector<uint64_t> &counts_;
61
- std::vector<uint64_t> &counts_pruned_;
62
- const std::vector<bool> &prune_words_;
63
-
64
- DiscountConfig discount_config_;
65
- std::vector<Discount> &discounts_;
66
- };
67
-
68
- } // namespace builder
69
- } // namespace lm
70
-
71
- #endif // LM_BUILDER_ADJUST_COUNTS_H
72
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/builder/corpus_count.hh DELETED
@@ -1,53 +0,0 @@
1
- #ifndef LM_BUILDER_CORPUS_COUNT_H
2
- #define LM_BUILDER_CORPUS_COUNT_H
3
-
4
- #include "lm/lm_exception.hh"
5
- #include "lm/word_index.hh"
6
- #include "util/scoped.hh"
7
-
8
- #include <cstddef>
9
- #include <string>
10
- #include <stdint.h>
11
- #include <vector>
12
-
13
- namespace util {
14
- class FilePiece;
15
- namespace stream {
16
- class ChainPosition;
17
- } // namespace stream
18
- } // namespace util
19
-
20
- namespace lm {
21
- namespace builder {
22
-
23
- class CorpusCount {
24
- public:
25
- // Memory usage will be DedupeMultipler(order) * block_size + total_chain_size + unknown vocab_hash_size
26
- static float DedupeMultiplier(std::size_t order);
27
-
28
- // How much memory vocabulary will use based on estimated size of the vocab.
29
- static std::size_t VocabUsage(std::size_t vocab_estimate);
30
-
31
- // token_count: out.
32
- // type_count aka vocabulary size. Initialize to an estimate. It is set to the exact value.
33
- CorpusCount(util::FilePiece &from, int vocab_write, uint64_t &token_count, WordIndex &type_count, std::vector<bool> &prune_words, const std::string& prune_vocab_filename, std::size_t entries_per_block, WarningAction disallowed_symbol);
34
-
35
- void Run(const util::stream::ChainPosition &position);
36
-
37
- private:
38
- util::FilePiece &from_;
39
- int vocab_write_;
40
- uint64_t &token_count_;
41
- WordIndex &type_count_;
42
- std::vector<bool>& prune_words_;
43
- const std::string& prune_vocab_filename_;
44
-
45
- std::size_t dedupe_mem_size_;
46
- util::scoped_malloc dedupe_mem_;
47
-
48
- WarningAction disallowed_symbol_action_;
49
- };
50
-
51
- } // namespace builder
52
- } // namespace lm
53
- #endif // LM_BUILDER_CORPUS_COUNT_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/builder/discount.hh DELETED
@@ -1,26 +0,0 @@
1
- #ifndef LM_BUILDER_DISCOUNT_H
2
- #define LM_BUILDER_DISCOUNT_H
3
-
4
- #include <algorithm>
5
-
6
- #include <stdint.h>
7
-
8
- namespace lm {
9
- namespace builder {
10
-
11
- struct Discount {
12
- float amount[4];
13
-
14
- float Get(uint64_t count) const {
15
- return amount[std::min<uint64_t>(count, 3)];
16
- }
17
-
18
- float Apply(uint64_t count) const {
19
- return static_cast<float>(count) - Get(count);
20
- }
21
- };
22
-
23
- } // namespace builder
24
- } // namespace lm
25
-
26
- #endif // LM_BUILDER_DISCOUNT_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/builder/hash_gamma.hh DELETED
@@ -1,19 +0,0 @@
1
- #ifndef LM_BUILDER_HASH_GAMMA__
2
- #define LM_BUILDER_HASH_GAMMA__
3
-
4
- #include <stdint.h>
5
-
6
- namespace lm { namespace builder {
7
-
8
- #pragma pack(push)
9
- #pragma pack(4)
10
-
11
- struct HashGamma {
12
- uint64_t hash_value;
13
- float gamma;
14
- };
15
-
16
- #pragma pack(pop)
17
-
18
- }} // namespaces
19
- #endif // LM_BUILDER_HASH_GAMMA__
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/builder/header_info.hh DELETED
@@ -1,24 +0,0 @@
1
- #ifndef LM_BUILDER_HEADER_INFO_H
2
- #define LM_BUILDER_HEADER_INFO_H
3
-
4
- #include <string>
5
- #include <vector>
6
- #include <stdint.h>
7
-
8
- // Some configuration info that is used to add
9
- // comments to the beginning of an ARPA file
10
- struct HeaderInfo {
11
- std::string input_file;
12
- uint64_t token_count;
13
- std::vector<uint64_t> counts_pruned;
14
-
15
- HeaderInfo() {}
16
-
17
- HeaderInfo(const std::string& input_file_in, uint64_t token_count_in, const std::vector<uint64_t> &counts_pruned_in)
18
- : input_file(input_file_in), token_count(token_count_in), counts_pruned(counts_pruned_in) {}
19
-
20
- // TODO: Add smoothing type
21
- // TODO: More info if multiple models were interpolated
22
- };
23
-
24
- #endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/builder/initial_probabilities.hh DELETED
@@ -1,42 +0,0 @@
1
- #ifndef LM_BUILDER_INITIAL_PROBABILITIES_H
2
- #define LM_BUILDER_INITIAL_PROBABILITIES_H
3
-
4
- #include "lm/builder/discount.hh"
5
- #include "util/stream/config.hh"
6
-
7
- #include <vector>
8
-
9
- namespace util { namespace stream { class Chains; } }
10
-
11
- namespace lm {
12
- namespace builder {
13
-
14
- struct InitialProbabilitiesConfig {
15
- // These should be small buffers to keep the adder from getting too far ahead
16
- util::stream::ChainConfig adder_in;
17
- util::stream::ChainConfig adder_out;
18
- // SRILM doesn't normally interpolate unigrams.
19
- bool interpolate_unigrams;
20
- };
21
-
22
- /* Compute initial (uninterpolated) probabilities
23
- * primary: the normal chain of n-grams. Incoming is context sorted adjusted
24
- * counts. Outgoing has uninterpolated probabilities for use by Interpolate.
25
- * second_in: a second copy of the primary input. Discard the output.
26
- * gamma_out: Computed gamma values are output on these chains in suffix order.
27
- * The values are bare floats and should be buffered for interpolation to
28
- * use.
29
- */
30
- void InitialProbabilities(
31
- const InitialProbabilitiesConfig &config,
32
- const std::vector<Discount> &discounts,
33
- util::stream::Chains &primary,
34
- util::stream::Chains &second_in,
35
- util::stream::Chains &gamma_out,
36
- const std::vector<uint64_t> &prune_thresholds,
37
- bool prune_vocab);
38
-
39
- } // namespace builder
40
- } // namespace lm
41
-
42
- #endif // LM_BUILDER_INITIAL_PROBABILITIES_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/builder/interpolate.hh DELETED
@@ -1,34 +0,0 @@
1
- #ifndef LM_BUILDER_INTERPOLATE_H
2
- #define LM_BUILDER_INTERPOLATE_H
3
-
4
- #include "util/stream/multi_stream.hh"
5
-
6
- #include <vector>
7
-
8
- #include <stdint.h>
9
-
10
- namespace lm { namespace builder {
11
-
12
- /* Interpolate step.
13
- * Input: suffix sorted n-grams with (p_uninterpolated, gamma) from
14
- * InitialProbabilities.
15
- * Output: suffix sorted n-grams with complete probability
16
- */
17
- class Interpolate {
18
- public:
19
- // Normally vocab_size is the unigram count-1 (since p(<s>) = 0) but might
20
- // be larger when the user specifies a consistent vocabulary size.
21
- explicit Interpolate(uint64_t vocab_size, const util::stream::ChainPositions &backoffs, const std::vector<uint64_t> &prune_thresholds, bool prune_vocab, bool output_q_);
22
-
23
- void Run(const util::stream::ChainPositions &positions);
24
-
25
- private:
26
- float uniform_prob_;
27
- util::stream::ChainPositions backoffs_;
28
- const std::vector<uint64_t> prune_thresholds_;
29
- bool prune_vocab_;
30
- bool output_q_;
31
- };
32
-
33
- }} // namespaces
34
- #endif // LM_BUILDER_INTERPOLATE_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/builder/joint_order.hh DELETED
@@ -1,67 +0,0 @@
1
- #ifndef LM_BUILDER_JOINT_ORDER_H
2
- #define LM_BUILDER_JOINT_ORDER_H
3
-
4
- #include "lm/builder/ngram_stream.hh"
5
- #include "lm/lm_exception.hh"
6
-
7
- #ifdef DEBUG
8
- #include "util/fixed_array.hh"
9
- #include <iostream>
10
- #endif
11
-
12
- #include <string.h>
13
-
14
- namespace lm { namespace builder {
15
-
16
- template <class Callback, class Compare> void JointOrder(const util::stream::ChainPositions &positions, Callback &callback) {
17
- // Allow matching to reference streams[-1].
18
- NGramStreams streams_with_dummy;
19
- streams_with_dummy.InitWithDummy(positions);
20
- NGramStream *streams = streams_with_dummy.begin() + 1;
21
-
22
- unsigned int order;
23
- for (order = 0; order < positions.size() && streams[order]; ++order) {}
24
- assert(order); // should always have <unk>.
25
-
26
- // Debugging only: call comparison function to sanity check order.
27
- #ifdef DEBUG
28
- util::FixedArray<Compare> less_compare(order);
29
- for (unsigned i = 0; i < order; ++i)
30
- less_compare.push_back(i + 1);
31
- #endif // DEBUG
32
-
33
- unsigned int current = 0;
34
- while (true) {
35
- // Does the context match the lower one?
36
- if (!memcmp(streams[static_cast<int>(current) - 1]->begin(), streams[current]->begin() + Compare::kMatchOffset, sizeof(WordIndex) * current)) {
37
- callback.Enter(current, *streams[current]);
38
- // Transition to looking for extensions.
39
- if (++current < order) continue;
40
- }
41
- #ifdef DEBUG
42
- // match_check[current - 1] matches current-grams
43
- // The lower-order stream (which skips fewer current-grams) should always be <= the higher order-stream (which can skip current-grams).
44
- else if (!less_compare[current - 1](streams[static_cast<int>(current) - 1]->begin(), streams[current]->begin() + Compare::kMatchOffset)) {
45
- std::cerr << "Stream out of order detected" << std::endl;
46
- abort();
47
- }
48
- #endif // DEBUG
49
- // No extension left.
50
- while(true) {
51
- assert(current > 0);
52
- --current;
53
- callback.Exit(current, *streams[current]);
54
-
55
- if (++streams[current]) break;
56
-
57
- UTIL_THROW_IF(order != current + 1, FormatLoadException, "Detected n-gram without matching suffix");
58
-
59
- order = current;
60
- if (!order) return;
61
- }
62
- }
63
- }
64
-
65
- }} // namespaces
66
-
67
- #endif // LM_BUILDER_JOINT_ORDER_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/builder/ngram.hh DELETED
@@ -1,109 +0,0 @@
1
- #ifndef LM_BUILDER_NGRAM_H
2
- #define LM_BUILDER_NGRAM_H
3
-
4
- #include "lm/weights.hh"
5
- #include "lm/word_index.hh"
6
-
7
- #include <cstddef>
8
-
9
- #include <assert.h>
10
- #include <stdint.h>
11
- #include <string.h>
12
-
13
- namespace lm {
14
- namespace builder {
15
-
16
- struct Uninterpolated {
17
- float prob; // Uninterpolated probability.
18
- float gamma; // Interpolation weight for lower order.
19
- };
20
-
21
- union Payload {
22
- uint64_t count;
23
- Uninterpolated uninterp;
24
- ProbBackoff complete;
25
- };
26
-
27
- class NGram {
28
- public:
29
- NGram(void *begin, std::size_t order)
30
- : begin_(static_cast<WordIndex*>(begin)), end_(begin_ + order) {}
31
-
32
- const uint8_t *Base() const { return reinterpret_cast<const uint8_t*>(begin_); }
33
- uint8_t *Base() { return reinterpret_cast<uint8_t*>(begin_); }
34
-
35
- void ReBase(void *to) {
36
- std::size_t difference = end_ - begin_;
37
- begin_ = reinterpret_cast<WordIndex*>(to);
38
- end_ = begin_ + difference;
39
- }
40
-
41
- // Would do operator++ but that can get confusing for a stream.
42
- void NextInMemory() {
43
- ReBase(&Value() + 1);
44
- }
45
-
46
- // Lower-case in deference to STL.
47
- const WordIndex *begin() const { return begin_; }
48
- WordIndex *begin() { return begin_; }
49
- const WordIndex *end() const { return end_; }
50
- WordIndex *end() { return end_; }
51
-
52
- const Payload &Value() const { return *reinterpret_cast<const Payload *>(end_); }
53
- Payload &Value() { return *reinterpret_cast<Payload *>(end_); }
54
-
55
- uint64_t &Count() { return Value().count; }
56
- uint64_t Count() const { return Value().count; }
57
-
58
- std::size_t Order() const { return end_ - begin_; }
59
-
60
- static std::size_t TotalSize(std::size_t order) {
61
- return order * sizeof(WordIndex) + sizeof(Payload);
62
- }
63
- std::size_t TotalSize() const {
64
- // Compiler should optimize this.
65
- return TotalSize(Order());
66
- }
67
- static std::size_t OrderFromSize(std::size_t size) {
68
- std::size_t ret = (size - sizeof(Payload)) / sizeof(WordIndex);
69
- assert(size == TotalSize(ret));
70
- return ret;
71
- }
72
-
73
- // manipulate msb to signal that ngram can be pruned
74
- /*mjd**********************************************************************/
75
-
76
- bool IsMarked() const {
77
- return Value().count >> (sizeof(Value().count) * 8 - 1);
78
- }
79
-
80
- void Mark() {
81
- Value().count |= (1ul << (sizeof(Value().count) * 8 - 1));
82
- }
83
-
84
- void Unmark() {
85
- Value().count &= ~(1ul << (sizeof(Value().count) * 8 - 1));
86
- }
87
-
88
- uint64_t UnmarkedCount() const {
89
- return Value().count & ~(1ul << (sizeof(Value().count) * 8 - 1));
90
- }
91
-
92
- uint64_t CutoffCount() const {
93
- return IsMarked() ? 0 : UnmarkedCount();
94
- }
95
-
96
- /*mjd**********************************************************************/
97
-
98
- private:
99
- WordIndex *begin_, *end_;
100
- };
101
-
102
- const WordIndex kUNK = 0;
103
- const WordIndex kBOS = 1;
104
- const WordIndex kEOS = 2;
105
-
106
- } // namespace builder
107
- } // namespace lm
108
-
109
- #endif // LM_BUILDER_NGRAM_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/builder/ngram_stream.hh DELETED
@@ -1,58 +0,0 @@
1
- #ifndef LM_BUILDER_NGRAM_STREAM_H
2
- #define LM_BUILDER_NGRAM_STREAM_H
3
-
4
- #include "lm/builder/ngram.hh"
5
- #include "util/stream/chain.hh"
6
- #include "util/stream/multi_stream.hh"
7
- #include "util/stream/stream.hh"
8
-
9
- #include <cstddef>
10
-
11
- namespace lm { namespace builder {
12
-
13
- class NGramStream {
14
- public:
15
- NGramStream() : gram_(NULL, 0) {}
16
-
17
- NGramStream(const util::stream::ChainPosition &position) : gram_(NULL, 0) {
18
- Init(position);
19
- }
20
-
21
- void Init(const util::stream::ChainPosition &position) {
22
- stream_.Init(position);
23
- gram_ = NGram(stream_.Get(), NGram::OrderFromSize(position.GetChain().EntrySize()));
24
- }
25
-
26
- NGram &operator*() { return gram_; }
27
- const NGram &operator*() const { return gram_; }
28
-
29
- NGram *operator->() { return &gram_; }
30
- const NGram *operator->() const { return &gram_; }
31
-
32
- void *Get() { return stream_.Get(); }
33
- const void *Get() const { return stream_.Get(); }
34
-
35
- operator bool() const { return stream_; }
36
- bool operator!() const { return !stream_; }
37
- void Poison() { stream_.Poison(); }
38
-
39
- NGramStream &operator++() {
40
- ++stream_;
41
- gram_.ReBase(stream_.Get());
42
- return *this;
43
- }
44
-
45
- private:
46
- NGram gram_;
47
- util::stream::Stream stream_;
48
- };
49
-
50
- inline util::stream::Chain &operator>>(util::stream::Chain &chain, NGramStream &str) {
51
- str.Init(chain.Add());
52
- return chain;
53
- }
54
-
55
- typedef util::stream::GenericStreams<NGramStream> NGramStreams;
56
-
57
- }} // namespaces
58
- #endif // LM_BUILDER_NGRAM_STREAM_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/builder/output.hh DELETED
@@ -1,89 +0,0 @@
1
- #ifndef LM_BUILDER_OUTPUT_H
2
- #define LM_BUILDER_OUTPUT_H
3
-
4
- #include "lm/builder/header_info.hh"
5
- #include "util/file.hh"
6
-
7
- #include <boost/ptr_container/ptr_vector.hpp>
8
- #include <boost/utility.hpp>
9
-
10
- #include <map>
11
-
12
- namespace util { namespace stream { class Chains; class ChainPositions; } }
13
-
14
- /* Outputs from lmplz: ARPA< sharded files, etc */
15
- namespace lm { namespace builder {
16
-
17
- // These are different types of hooks. Values should be consecutive to enable a vector lookup.
18
- enum HookType {
19
- COUNT_HOOK, // Raw N-gram counts, highest order only.
20
- PROB_PARALLEL_HOOK, // Probability and backoff (or just q). Output must process the orders in parallel or there will be a deadlock.
21
- PROB_SEQUENTIAL_HOOK, // Probability and backoff (or just q). Output can process orders any way it likes. This requires writing the data to disk then reading. Useful for ARPA files, which put unigrams first etc.
22
- NUMBER_OF_HOOKS // Keep this last so we know how many values there are.
23
- };
24
-
25
- class Output;
26
-
27
- class OutputHook {
28
- public:
29
- explicit OutputHook(HookType hook_type) : type_(hook_type), master_(NULL) {}
30
-
31
- virtual ~OutputHook();
32
-
33
- virtual void Apply(util::stream::Chains &chains);
34
-
35
- virtual void Run(const util::stream::ChainPositions &positions) = 0;
36
-
37
- protected:
38
- const HeaderInfo &GetHeader() const;
39
- int GetVocabFD() const;
40
-
41
- private:
42
- friend class Output;
43
- const HookType type_;
44
- const Output *master_;
45
- };
46
-
47
- class Output : boost::noncopyable {
48
- public:
49
- Output() {}
50
-
51
- // Takes ownership.
52
- void Add(OutputHook *hook) {
53
- hook->master_ = this;
54
- outputs_[hook->type_].push_back(hook);
55
- }
56
-
57
- bool Have(HookType hook_type) const {
58
- return !outputs_[hook_type].empty();
59
- }
60
-
61
- void SetVocabFD(int to) { vocab_fd_ = to; }
62
- int GetVocabFD() const { return vocab_fd_; }
63
-
64
- void SetHeader(const HeaderInfo &header) { header_ = header; }
65
- const HeaderInfo &GetHeader() const { return header_; }
66
-
67
- void Apply(HookType hook_type, util::stream::Chains &chains) {
68
- for (boost::ptr_vector<OutputHook>::iterator entry = outputs_[hook_type].begin(); entry != outputs_[hook_type].end(); ++entry) {
69
- entry->Apply(chains);
70
- }
71
- }
72
-
73
- private:
74
- boost::ptr_vector<OutputHook> outputs_[NUMBER_OF_HOOKS];
75
- int vocab_fd_;
76
- HeaderInfo header_;
77
- };
78
-
79
- inline const HeaderInfo &OutputHook::GetHeader() const {
80
- return master_->GetHeader();
81
- }
82
-
83
- inline int OutputHook::GetVocabFD() const {
84
- return master_->GetVocabFD();
85
- }
86
-
87
- }} // namespaces
88
-
89
- #endif // LM_BUILDER_OUTPUT_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/builder/pipeline.hh DELETED
@@ -1,74 +0,0 @@
1
- #ifndef LM_BUILDER_PIPELINE_H
2
- #define LM_BUILDER_PIPELINE_H
3
-
4
- #include "lm/builder/adjust_counts.hh"
5
- #include "lm/builder/initial_probabilities.hh"
6
- #include "lm/builder/header_info.hh"
7
- #include "lm/lm_exception.hh"
8
- #include "lm/word_index.hh"
9
- #include "util/stream/config.hh"
10
- #include "util/file_piece.hh"
11
-
12
- #include <string>
13
- #include <cstddef>
14
-
15
- namespace lm { namespace builder {
16
-
17
- class Output;
18
-
19
- struct PipelineConfig {
20
- std::size_t order;
21
- std::string vocab_file;
22
- util::stream::SortConfig sort;
23
- InitialProbabilitiesConfig initial_probs;
24
- util::stream::ChainConfig read_backoffs;
25
-
26
- // Estimated vocabulary size. Used for sizing CorpusCount memory and
27
- // initial probing hash table sizing, also in CorpusCount.
28
- lm::WordIndex vocab_estimate;
29
-
30
- // Minimum block size to tolerate.
31
- std::size_t minimum_block;
32
-
33
- // Number of blocks to use. This will be overridden to 1 if everything fits.
34
- std::size_t block_count;
35
-
36
- // n-gram count thresholds for pruning. 0 values means no pruning for
37
- // corresponding n-gram order
38
- std::vector<uint64_t> prune_thresholds; //mjd
39
- bool prune_vocab;
40
- std::string prune_vocab_file;
41
-
42
- // What to do with discount failures.
43
- DiscountConfig discount;
44
-
45
- // Compute collapsed q values instead of probability and backoff
46
- bool output_q;
47
-
48
- /* Computing the perplexity of LMs with different vocabularies is hard. For
49
- * example, the lowest perplexity is attained by a unigram model that
50
- * predicts p(<unk>) = 1 and has no other vocabulary. Also, linearly
51
- * interpolated models will sum to more than 1 because <unk> is duplicated
52
- * (SRI just pretends p(<unk>) = 0 for these purposes, which makes it sum to
53
- * 1 but comes with its own problems). This option will make the vocabulary
54
- * a particular size by replicating <unk> multiple times for purposes of
55
- * computing vocabulary size. It has no effect if the actual vocabulary is
56
- * larger. This parameter serves the same purpose as IRSTLM's "dub".
57
- */
58
- uint64_t vocab_size_for_unk;
59
-
60
- /* What to do the first time <s>, </s>, or <unk> appears in the input. If
61
- * this is anything but THROW_UP, then the symbol will always be treated as
62
- * whitespace.
63
- */
64
- WarningAction disallowed_symbol_action;
65
-
66
- const std::string &TempPrefix() const { return sort.temp_prefix; }
67
- std::size_t TotalMemory() const { return sort.total_memory; }
68
- };
69
-
70
- // Takes ownership of text_file and out_arpa.
71
- void Pipeline(PipelineConfig &config, int text_file, Output &output);
72
-
73
- }} // namespaces
74
- #endif // LM_BUILDER_PIPELINE_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/builder/print.hh DELETED
@@ -1,115 +0,0 @@
1
- #ifndef LM_BUILDER_PRINT_H
2
- #define LM_BUILDER_PRINT_H
3
-
4
- #include "lm/builder/ngram.hh"
5
- #include "lm/builder/ngram_stream.hh"
6
- #include "lm/builder/output.hh"
7
- #include "util/fake_ofstream.hh"
8
- #include "util/file.hh"
9
- #include "util/mmap.hh"
10
- #include "util/string_piece.hh"
11
-
12
- #include <ostream>
13
-
14
- #include <assert.h>
15
-
16
- // Warning: print routines read all unigrams before all bigrams before all
17
- // trigrams etc. So if other parts of the chain move jointly, you'll have to
18
- // buffer.
19
-
20
- namespace lm { namespace builder {
21
-
22
- class VocabReconstitute {
23
- public:
24
- // fd must be alive for life of this object; does not take ownership.
25
- explicit VocabReconstitute(int fd);
26
-
27
- const char *Lookup(WordIndex index) const {
28
- assert(index < map_.size() - 1);
29
- return map_[index];
30
- }
31
-
32
- StringPiece LookupPiece(WordIndex index) const {
33
- return StringPiece(map_[index], map_[index + 1] - 1 - map_[index]);
34
- }
35
-
36
- std::size_t Size() const {
37
- // There's an extra entry to support StringPiece lengths.
38
- return map_.size() - 1;
39
- }
40
-
41
- private:
42
- util::scoped_memory memory_;
43
- std::vector<const char*> map_;
44
- };
45
-
46
- // Not defined, only specialized.
47
- template <class T> void PrintPayload(util::FakeOFStream &to, const Payload &payload);
48
- template <> inline void PrintPayload<uint64_t>(util::FakeOFStream &to, const Payload &payload) {
49
- // TODO slow
50
- to << boost::lexical_cast<std::string>(payload.count);
51
- }
52
- template <> inline void PrintPayload<Uninterpolated>(util::FakeOFStream &to, const Payload &payload) {
53
- to << log10(payload.uninterp.prob) << ' ' << log10(payload.uninterp.gamma);
54
- }
55
- template <> inline void PrintPayload<ProbBackoff>(util::FakeOFStream &to, const Payload &payload) {
56
- to << payload.complete.prob << ' ' << payload.complete.backoff;
57
- }
58
-
59
- // template parameter is the type stored.
60
- template <class V> class Print {
61
- public:
62
- static void DumpSeparateFiles(const VocabReconstitute &vocab, const std::string &file_base, util::stream::Chains &chains) {
63
- for (unsigned int i = 0; i < chains.size(); ++i) {
64
- std::string file(file_base + boost::lexical_cast<std::string>(i));
65
- chains[i] >> Print(vocab, util::CreateOrThrow(file.c_str()));
66
- }
67
- }
68
-
69
- explicit Print(const VocabReconstitute &vocab, int fd) : vocab_(vocab), to_(fd) {}
70
-
71
- void Run(const util::stream::ChainPositions &chains) {
72
- util::scoped_fd fd(to_);
73
- util::FakeOFStream out(to_);
74
- NGramStreams streams(chains);
75
- for (NGramStream *s = streams.begin(); s != streams.end(); ++s) {
76
- DumpStream(*s, out);
77
- }
78
- }
79
-
80
- void Run(const util::stream::ChainPosition &position) {
81
- util::scoped_fd fd(to_);
82
- util::FakeOFStream out(to_);
83
- NGramStream stream(position);
84
- DumpStream(stream, out);
85
- }
86
-
87
- private:
88
- void DumpStream(NGramStream &stream, util::FakeOFStream &to) {
89
- for (; stream; ++stream) {
90
- PrintPayload<V>(to, stream->Value());
91
- for (const WordIndex *w = stream->begin(); w != stream->end(); ++w) {
92
- to << ' ' << vocab_.Lookup(*w) << '=' << *w;
93
- }
94
- to << '\n';
95
- }
96
- }
97
-
98
- const VocabReconstitute &vocab_;
99
- int to_;
100
- };
101
-
102
- class PrintARPA : public OutputHook {
103
- public:
104
- explicit PrintARPA(int fd, bool verbose_header)
105
- : OutputHook(PROB_SEQUENTIAL_HOOK), out_fd_(fd), verbose_header_(verbose_header) {}
106
-
107
- void Run(const util::stream::ChainPositions &positions);
108
-
109
- private:
110
- util::scoped_fd out_fd_;
111
- bool verbose_header_;
112
- };
113
-
114
- }} // namespaces
115
- #endif // LM_BUILDER_PRINT_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/builder/sort.hh DELETED
@@ -1,244 +0,0 @@
1
- #ifndef LM_BUILDER_SORT_H
2
- #define LM_BUILDER_SORT_H
3
-
4
- #include "lm/builder/ngram_stream.hh"
5
- #include "lm/builder/ngram.hh"
6
- #include "lm/word_index.hh"
7
- #include "util/stream/sort.hh"
8
-
9
- #include "util/stream/timer.hh"
10
-
11
- #include <functional>
12
- #include <string>
13
-
14
- namespace lm {
15
- namespace builder {
16
-
17
- /**
18
- * Abstract parent class for defining custom n-gram comparators.
19
- */
20
- template <class Child> class Comparator : public std::binary_function<const void *, const void *, bool> {
21
- public:
22
-
23
- /**
24
- * Constructs a comparator capable of comparing two n-grams.
25
- *
26
- * @param order Number of words in each n-gram
27
- */
28
- explicit Comparator(std::size_t order) : order_(order) {}
29
-
30
- /**
31
- * Applies the comparator using the Compare method that must be defined in any class that inherits from this class.
32
- *
33
- * @param lhs A pointer to the n-gram on the left-hand side of the comparison
34
- * @param rhs A pointer to the n-gram on the right-hand side of the comparison
35
- *
36
- * @see ContextOrder::Compare
37
- * @see PrefixOrder::Compare
38
- * @see SuffixOrder::Compare
39
- */
40
- inline bool operator()(const void *lhs, const void *rhs) const {
41
- return static_cast<const Child*>(this)->Compare(static_cast<const WordIndex*>(lhs), static_cast<const WordIndex*>(rhs));
42
- }
43
-
44
- /** Gets the n-gram order defined for this comparator. */
45
- std::size_t Order() const { return order_; }
46
-
47
- protected:
48
- std::size_t order_;
49
- };
50
-
51
- /**
52
- * N-gram comparator that compares n-grams according to their reverse (suffix) order.
53
- *
54
- * This comparator compares n-grams lexicographically, one word at a time,
55
- * beginning with the last word of each n-gram and ending with the first word of each n-gram.
56
- *
57
- * Some examples of n-gram comparisons as defined by this comparator:
58
- * - a b c == a b c
59
- * - a b c < a b d
60
- * - a b c > a d b
61
- * - a b c > a b b
62
- * - a b c > x a c
63
- * - a b c < x y z
64
- */
65
- class SuffixOrder : public Comparator<SuffixOrder> {
66
- public:
67
-
68
- /**
69
- * Constructs a comparator capable of comparing two n-grams.
70
- *
71
- * @param order Number of words in each n-gram
72
- */
73
- explicit SuffixOrder(std::size_t order) : Comparator<SuffixOrder>(order) {}
74
-
75
- /**
76
- * Compares two n-grams lexicographically, one word at a time,
77
- * beginning with the last word of each n-gram and ending with the first word of each n-gram.
78
- *
79
- * @param lhs A pointer to the n-gram on the left-hand side of the comparison
80
- * @param rhs A pointer to the n-gram on the right-hand side of the comparison
81
- */
82
- inline bool Compare(const WordIndex *lhs, const WordIndex *rhs) const {
83
- for (std::size_t i = order_ - 1; i != 0; --i) {
84
- if (lhs[i] != rhs[i])
85
- return lhs[i] < rhs[i];
86
- }
87
- return lhs[0] < rhs[0];
88
- }
89
-
90
- static const unsigned kMatchOffset = 1;
91
- };
92
-
93
-
94
- /**
95
- * N-gram comparator that compares n-grams according to the reverse (suffix) order of the n-gram context.
96
- *
97
- * This comparator compares n-grams lexicographically, one word at a time,
98
- * beginning with the penultimate word of each n-gram and ending with the first word of each n-gram;
99
- * finally, this comparator compares the last word of each n-gram.
100
- *
101
- * Some examples of n-gram comparisons as defined by this comparator:
102
- * - a b c == a b c
103
- * - a b c < a b d
104
- * - a b c < a d b
105
- * - a b c > a b b
106
- * - a b c > x a c
107
- * - a b c < x y z
108
- */
109
- class ContextOrder : public Comparator<ContextOrder> {
110
- public:
111
-
112
- /**
113
- * Constructs a comparator capable of comparing two n-grams.
114
- *
115
- * @param order Number of words in each n-gram
116
- */
117
- explicit ContextOrder(std::size_t order) : Comparator<ContextOrder>(order) {}
118
-
119
- /**
120
- * Compares two n-grams lexicographically, one word at a time,
121
- * beginning with the penultimate word of each n-gram and ending with the first word of each n-gram;
122
- * finally, this comparator compares the last word of each n-gram.
123
- *
124
- * @param lhs A pointer to the n-gram on the left-hand side of the comparison
125
- * @param rhs A pointer to the n-gram on the right-hand side of the comparison
126
- */
127
- inline bool Compare(const WordIndex *lhs, const WordIndex *rhs) const {
128
- for (int i = order_ - 2; i >= 0; --i) {
129
- if (lhs[i] != rhs[i])
130
- return lhs[i] < rhs[i];
131
- }
132
- return lhs[order_ - 1] < rhs[order_ - 1];
133
- }
134
- };
135
-
136
- /**
137
- * N-gram comparator that compares n-grams according to their natural (prefix) order.
138
- *
139
- * This comparator compares n-grams lexicographically, one word at a time,
140
- * beginning with the first word of each n-gram and ending with the last word of each n-gram.
141
- *
142
- * Some examples of n-gram comparisons as defined by this comparator:
143
- * - a b c == a b c
144
- * - a b c < a b d
145
- * - a b c < a d b
146
- * - a b c > a b b
147
- * - a b c < x a c
148
- * - a b c < x y z
149
- */
150
- class PrefixOrder : public Comparator<PrefixOrder> {
151
- public:
152
-
153
- /**
154
- * Constructs a comparator capable of comparing two n-grams.
155
- *
156
- * @param order Number of words in each n-gram
157
- */
158
- explicit PrefixOrder(std::size_t order) : Comparator<PrefixOrder>(order) {}
159
-
160
- /**
161
- * Compares two n-grams lexicographically, one word at a time,
162
- * beginning with the first word of each n-gram and ending with the last word of each n-gram.
163
- *
164
- * @param lhs A pointer to the n-gram on the left-hand side of the comparison
165
- * @param rhs A pointer to the n-gram on the right-hand side of the comparison
166
- */
167
- inline bool Compare(const WordIndex *lhs, const WordIndex *rhs) const {
168
- for (std::size_t i = 0; i < order_; ++i) {
169
- if (lhs[i] != rhs[i])
170
- return lhs[i] < rhs[i];
171
- }
172
- return false;
173
- }
174
-
175
- static const unsigned kMatchOffset = 0;
176
- };
177
-
178
- // Sum counts for the same n-gram.
179
- struct AddCombiner {
180
- bool operator()(void *first_void, const void *second_void, const SuffixOrder &compare) const {
181
- NGram first(first_void, compare.Order());
182
- // There isn't a const version of NGram.
183
- NGram second(const_cast<void*>(second_void), compare.Order());
184
- if (memcmp(first.begin(), second.begin(), sizeof(WordIndex) * compare.Order())) return false;
185
- first.Count() += second.Count();
186
- return true;
187
- }
188
- };
189
-
190
- // The combiner is only used on a single chain, so I didn't bother to allow
191
- // that template.
192
- /**
193
- * Represents an @ref util::FixedArray "array" capable of storing @ref util::stream::Sort "Sort" objects.
194
- *
195
- * In the anticipated use case, an instance of this class will maintain one @ref util::stream::Sort "Sort" object
196
- * for each n-gram order (ranging from 1 up to the maximum n-gram order being processed).
197
- * Use in this manner would enable the n-grams each n-gram order to be sorted, in parallel.
198
- *
199
- * @tparam Compare An @ref Comparator "ngram comparator" to use during sorting.
200
- */
201
- template <class Compare> class Sorts : public util::FixedArray<util::stream::Sort<Compare> > {
202
- private:
203
- typedef util::stream::Sort<Compare> S;
204
- typedef util::FixedArray<S> P;
205
-
206
- public:
207
-
208
- /**
209
- * Constructs, but does not initialize.
210
- *
211
- * @ref util::FixedArray::Init() "Init" must be called before use.
212
- *
213
- * @see util::FixedArray::Init()
214
- */
215
- Sorts() {}
216
-
217
- /**
218
- * Constructs an @ref util::FixedArray "array" capable of storing a fixed number of @ref util::stream::Sort "Sort" objects.
219
- *
220
- * @param number The maximum number of @ref util::stream::Sort "sorters" that can be held by this @ref util::FixedArray "array"
221
- * @see util::FixedArray::FixedArray()
222
- */
223
- explicit Sorts(std::size_t number) : util::FixedArray<util::stream::Sort<Compare> >(number) {}
224
-
225
- /**
226
- * Constructs a new @ref util::stream::Sort "Sort" object which is stored in this @ref util::FixedArray "array".
227
- *
228
- * The new @ref util::stream::Sort "Sort" object is constructed using the provided @ref util::stream::SortConfig "SortConfig" and @ref Comparator "ngram comparator";
229
- * once constructed, a new worker @ref util::stream::Thread "thread" (owned by the @ref util::stream::Chain "chain") will sort the n-gram data stored
230
- * in the @ref util::stream::Block "blocks" of the provided @ref util::stream::Chain "chain".
231
- *
232
- * @see util::stream::Sort::Sort()
233
- * @see util::stream::Chain::operator>>()
234
- */
235
- void push_back(util::stream::Chain &chain, const util::stream::SortConfig &config, const Compare &compare) {
236
- new (P::end()) S(chain, config, compare); // use "placement new" syntax to initalize S in an already-allocated memory location
237
- P::Constructed();
238
- }
239
- };
240
-
241
- } // namespace builder
242
- } // namespace lm
243
-
244
- #endif // LM_BUILDER_SORT_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/config.hh DELETED
@@ -1,124 +0,0 @@
1
- #ifndef LM_CONFIG_H
2
- #define LM_CONFIG_H
3
-
4
- #include "lm/lm_exception.hh"
5
- #include "util/mmap.hh"
6
-
7
- #include <iosfwd>
8
- #include <string>
9
- #include <vector>
10
-
11
- /* Configuration for ngram model. Separate header to reduce pollution. */
12
-
13
- namespace lm {
14
-
15
- class EnumerateVocab;
16
-
17
- namespace ngram {
18
-
19
- struct Config {
20
- // EFFECTIVE FOR BOTH ARPA AND BINARY READS
21
-
22
- // (default true) print progress bar to messages
23
- bool show_progress;
24
-
25
- // Where to log messages including the progress bar. Set to NULL for
26
- // silence.
27
- std::ostream *messages;
28
-
29
- std::ostream *ProgressMessages() const {
30
- return show_progress ? messages : 0;
31
- }
32
-
33
- // This will be called with every string in the vocabulary by the
34
- // constructor; it need only exist for the lifetime of the constructor.
35
- // See enumerate_vocab.hh for more detail. Config does not take ownership;
36
- // just delete/let it go out of scope after the constructor exits.
37
- EnumerateVocab *enumerate_vocab;
38
-
39
-
40
- // ONLY EFFECTIVE WHEN READING ARPA
41
-
42
- // What to do when <unk> isn't in the provided model.
43
- WarningAction unknown_missing;
44
- // What to do when <s> or </s> is missing from the model.
45
- // If THROW_UP, the exception will be of type util::SpecialWordMissingException.
46
- WarningAction sentence_marker_missing;
47
-
48
- // What to do with a positive log probability. For COMPLAIN and SILENT, map
49
- // to 0.
50
- WarningAction positive_log_probability;
51
-
52
- // The probability to substitute for <unk> if it's missing from the model.
53
- // No effect if the model has <unk> or unknown_missing == THROW_UP.
54
- float unknown_missing_logprob;
55
-
56
- // Size multiplier for probing hash table. Must be > 1. Space is linear in
57
- // this. Time is probing_multiplier / (probing_multiplier - 1). No effect
58
- // for sorted variant.
59
- // If you find yourself setting this to a low number, consider using the
60
- // TrieModel which has lower memory consumption.
61
- float probing_multiplier;
62
-
63
- // Amount of memory to use for building. The actual memory usage will be
64
- // higher since this just sets sort buffer size. Only applies to trie
65
- // models.
66
- std::size_t building_memory;
67
-
68
- // Template for temporary directory appropriate for passing to mkdtemp.
69
- // The characters XXXXXX are appended before passing to mkdtemp. Only
70
- // applies to trie. If empty, defaults to write_mmap. If that's NULL,
71
- // defaults to input file name.
72
- std::string temporary_directory_prefix;
73
-
74
- // Level of complaining to do when loading from ARPA instead of binary format.
75
- enum ARPALoadComplain {ALL, EXPENSIVE, NONE};
76
- ARPALoadComplain arpa_complain;
77
-
78
- // While loading an ARPA file, also write out this binary format file. Set
79
- // to NULL to disable.
80
- const char *write_mmap;
81
-
82
- enum WriteMethod {
83
- WRITE_MMAP, // Map the file directly.
84
- WRITE_AFTER // Write after we're done.
85
- };
86
- WriteMethod write_method;
87
-
88
- // Include the vocab in the binary file? Only effective if write_mmap != NULL.
89
- bool include_vocab;
90
-
91
-
92
- // Left rest options. Only used when the model includes rest costs.
93
- enum RestFunction {
94
- REST_MAX, // Maximum of any score to the left
95
- REST_LOWER, // Use lower-order files given below.
96
- };
97
- RestFunction rest_function;
98
- // Only used for REST_LOWER.
99
- std::vector<std::string> rest_lower_files;
100
-
101
-
102
- // Quantization options. Only effective for QuantTrieModel. One value is
103
- // reserved for each of prob and backoff, so 2^bits - 1 buckets will be used
104
- // to quantize (and one of the remaining backoffs will be 0).
105
- uint8_t prob_bits, backoff_bits;
106
-
107
- // Bhiksha compression (simple form). Only works with trie.
108
- uint8_t pointer_bhiksha_bits;
109
-
110
-
111
- // ONLY EFFECTIVE WHEN READING BINARY
112
-
113
- // How to get the giant array into memory: lazy mmap, populate, read etc.
114
- // See util/mmap.hh for details of MapMethod.
115
- util::LoadMethod load_method;
116
-
117
-
118
- // Set defaults.
119
- Config();
120
- };
121
-
122
- } /* namespace ngram */ } /* namespace lm */
123
-
124
- #endif // LM_CONFIG_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/enumerate_vocab.hh DELETED
@@ -1,28 +0,0 @@
1
- #ifndef LM_ENUMERATE_VOCAB_H
2
- #define LM_ENUMERATE_VOCAB_H
3
-
4
- #include "lm/word_index.hh"
5
- #include "util/string_piece.hh"
6
-
7
- namespace lm {
8
-
9
- /* If you need the actual strings in the vocabulary, inherit from this class
10
- * and implement Add. Then put a pointer in Config.enumerate_vocab; it does
11
- * not take ownership. Add is called once per vocab word. index starts at 0
12
- * and increases by 1 each time. This is only used by the Model constructor;
13
- * the pointer is not retained by the class.
14
- */
15
- class EnumerateVocab {
16
- public:
17
- virtual ~EnumerateVocab() {}
18
-
19
- virtual void Add(WordIndex index, const StringPiece &str) = 0;
20
-
21
- protected:
22
- EnumerateVocab() {}
23
- };
24
-
25
- } // namespace lm
26
-
27
- #endif // LM_ENUMERATE_VOCAB_H
28
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/facade.hh DELETED
@@ -1,73 +0,0 @@
1
- #ifndef LM_FACADE_H
2
- #define LM_FACADE_H
3
-
4
- #include "lm/virtual_interface.hh"
5
- #include "util/string_piece.hh"
6
-
7
- #include <string>
8
-
9
- namespace lm {
10
- namespace base {
11
-
12
- // Common model interface that depends on knowing the specific classes.
13
- // Curiously recurring template pattern.
14
- template <class Child, class StateT, class VocabularyT> class ModelFacade : public Model {
15
- public:
16
- typedef StateT State;
17
- typedef VocabularyT Vocabulary;
18
-
19
- /* Translate from void* to State */
20
- FullScoreReturn BaseFullScore(const void *in_state, const WordIndex new_word, void *out_state) const {
21
- return static_cast<const Child*>(this)->FullScore(
22
- *reinterpret_cast<const State*>(in_state),
23
- new_word,
24
- *reinterpret_cast<State*>(out_state));
25
- }
26
-
27
- FullScoreReturn BaseFullScoreForgotState(const WordIndex *context_rbegin, const WordIndex *context_rend, const WordIndex new_word, void *out_state) const {
28
- return static_cast<const Child*>(this)->FullScoreForgotState(
29
- context_rbegin,
30
- context_rend,
31
- new_word,
32
- *reinterpret_cast<State*>(out_state));
33
- }
34
-
35
- // Default Score function calls FullScore. Model can override this.
36
- float Score(const State &in_state, const WordIndex new_word, State &out_state) const {
37
- return static_cast<const Child*>(this)->FullScore(in_state, new_word, out_state).prob;
38
- }
39
-
40
- float BaseScore(const void *in_state, const WordIndex new_word, void *out_state) const {
41
- return static_cast<const Child*>(this)->Score(
42
- *reinterpret_cast<const State*>(in_state),
43
- new_word,
44
- *reinterpret_cast<State*>(out_state));
45
- }
46
-
47
- const State &BeginSentenceState() const { return begin_sentence_; }
48
- const State &NullContextState() const { return null_context_; }
49
- const Vocabulary &GetVocabulary() const { return *static_cast<const Vocabulary*>(&BaseVocabulary()); }
50
-
51
- protected:
52
- ModelFacade() : Model(sizeof(State)) {}
53
-
54
- virtual ~ModelFacade() {}
55
-
56
- // begin_sentence and null_context can disappear after. vocab should stay.
57
- void Init(const State &begin_sentence, const State &null_context, const Vocabulary &vocab, unsigned char order) {
58
- begin_sentence_ = begin_sentence;
59
- null_context_ = null_context;
60
- begin_sentence_memory_ = &begin_sentence_;
61
- null_context_memory_ = &null_context_;
62
- base_vocab_ = &vocab;
63
- order_ = order;
64
- }
65
-
66
- private:
67
- State begin_sentence_, null_context_;
68
- };
69
-
70
- } // mamespace base
71
- } // namespace lm
72
-
73
- #endif // LM_FACADE_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/filter/arpa_io.hh DELETED
@@ -1,114 +0,0 @@
1
- #ifndef LM_FILTER_ARPA_IO_H
2
- #define LM_FILTER_ARPA_IO_H
3
- /* Input and output for ARPA format language model files.
4
- */
5
- #include "lm/read_arpa.hh"
6
- #include "util/exception.hh"
7
- #include "util/string_piece.hh"
8
- #include "util/tokenize_piece.hh"
9
-
10
- #include <boost/noncopyable.hpp>
11
- #include <boost/scoped_array.hpp>
12
-
13
- #include <fstream>
14
- #include <string>
15
- #include <vector>
16
-
17
- #include <string.h>
18
- #include <stdint.h>
19
-
20
- namespace util { class FilePiece; }
21
-
22
- namespace lm {
23
-
24
- class ARPAInputException : public util::Exception {
25
- public:
26
- explicit ARPAInputException(const StringPiece &message) throw();
27
- explicit ARPAInputException(const StringPiece &message, const StringPiece &line) throw();
28
- virtual ~ARPAInputException() throw();
29
- };
30
-
31
- class ARPAOutputException : public util::ErrnoException {
32
- public:
33
- ARPAOutputException(const char *prefix, const std::string &file_name) throw();
34
- virtual ~ARPAOutputException() throw();
35
-
36
- const std::string &File() const throw() { return file_name_; }
37
-
38
- private:
39
- const std::string file_name_;
40
- };
41
-
42
- // Handling for the counts of n-grams at the beginning of ARPA files.
43
- size_t SizeNeededForCounts(const std::vector<uint64_t> &number);
44
-
45
- /* Writes an ARPA file. This has to be seekable so the counts can be written
46
- * at the end. Hence, I just have it own a std::fstream instead of accepting
47
- * a separately held std::ostream. TODO: use the fast one from estimation.
48
- */
49
- class ARPAOutput : boost::noncopyable {
50
- public:
51
- explicit ARPAOutput(const char *name, size_t buffer_size = 65536);
52
-
53
- void ReserveForCounts(std::streampos reserve);
54
-
55
- void BeginLength(unsigned int length);
56
-
57
- void AddNGram(const StringPiece &line) {
58
- try {
59
- file_ << line << '\n';
60
- } catch (const std::ios_base::failure &f) {
61
- throw ARPAOutputException("Writing an n-gram", file_name_);
62
- }
63
- ++fast_counter_;
64
- }
65
-
66
- void AddNGram(const StringPiece &ngram, const StringPiece &line) {
67
- AddNGram(line);
68
- }
69
-
70
- template <class Iterator> void AddNGram(const Iterator &begin, const Iterator &end, const StringPiece &line) {
71
- AddNGram(line);
72
- }
73
-
74
- void EndLength(unsigned int length);
75
-
76
- void Finish();
77
-
78
- private:
79
- const std::string file_name_;
80
- boost::scoped_array<char> buffer_;
81
- std::fstream file_;
82
- size_t fast_counter_;
83
- std::vector<uint64_t> counts_;
84
- };
85
-
86
-
87
- template <class Output> void ReadNGrams(util::FilePiece &in, unsigned int length, uint64_t number, Output &out) {
88
- ReadNGramHeader(in, length);
89
- out.BeginLength(length);
90
- for (uint64_t i = 0; i < number; ++i) {
91
- StringPiece line = in.ReadLine();
92
- util::TokenIter<util::SingleCharacter> tabber(line, '\t');
93
- if (!tabber) throw ARPAInputException("blank line", line);
94
- if (!++tabber) throw ARPAInputException("no tab", line);
95
-
96
- out.AddNGram(*tabber, line);
97
- }
98
- out.EndLength(length);
99
- }
100
-
101
- template <class Output> void ReadARPA(util::FilePiece &in_lm, Output &out) {
102
- std::vector<uint64_t> number;
103
- ReadARPACounts(in_lm, number);
104
- out.ReserveForCounts(SizeNeededForCounts(number));
105
- for (unsigned int i = 0; i < number.size(); ++i) {
106
- ReadNGrams(in_lm, i + 1, number[i], out);
107
- }
108
- ReadEnd(in_lm);
109
- out.Finish();
110
- }
111
-
112
- } // namespace lm
113
-
114
- #endif // LM_FILTER_ARPA_IO_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/filter/count_io.hh DELETED
@@ -1,89 +0,0 @@
1
- #ifndef LM_FILTER_COUNT_IO_H
2
- #define LM_FILTER_COUNT_IO_H
3
-
4
- #include <fstream>
5
- #include <iostream>
6
- #include <string>
7
-
8
- #include "util/fake_ofstream.hh"
9
- #include "util/file.hh"
10
- #include "util/file_piece.hh"
11
-
12
- namespace lm {
13
-
14
- class CountOutput : boost::noncopyable {
15
- public:
16
- explicit CountOutput(const char *name) : file_(util::CreateOrThrow(name)) {}
17
-
18
- void AddNGram(const StringPiece &line) {
19
- file_ << line << '\n';
20
- }
21
-
22
- template <class Iterator> void AddNGram(const Iterator &begin, const Iterator &end, const StringPiece &line) {
23
- AddNGram(line);
24
- }
25
-
26
- void AddNGram(const StringPiece &ngram, const StringPiece &line) {
27
- AddNGram(line);
28
- }
29
-
30
- private:
31
- util::FakeOFStream file_;
32
- };
33
-
34
- class CountBatch {
35
- public:
36
- explicit CountBatch(std::streamsize initial_read)
37
- : initial_read_(initial_read) {
38
- buffer_.reserve(initial_read);
39
- }
40
-
41
- void Read(std::istream &in) {
42
- buffer_.resize(initial_read_);
43
- in.read(&*buffer_.begin(), initial_read_);
44
- buffer_.resize(in.gcount());
45
- char got;
46
- while (in.get(got) && got != '\n')
47
- buffer_.push_back(got);
48
- }
49
-
50
- template <class Output> void Send(Output &out) {
51
- for (util::TokenIter<util::SingleCharacter> line(StringPiece(&*buffer_.begin(), buffer_.size()), '\n'); line; ++line) {
52
- util::TokenIter<util::SingleCharacter> tabber(*line, '\t');
53
- if (!tabber) {
54
- std::cerr << "Warning: empty n-gram count line being removed\n";
55
- continue;
56
- }
57
- util::TokenIter<util::SingleCharacter, true> words(*tabber, ' ');
58
- if (!words) {
59
- std::cerr << "Line has a tab but no words.\n";
60
- continue;
61
- }
62
- out.AddNGram(words, util::TokenIter<util::SingleCharacter, true>::end(), *line);
63
- }
64
- }
65
-
66
- private:
67
- std::streamsize initial_read_;
68
-
69
- // This could have been a std::string but that's less happy with raw writes.
70
- std::vector<char> buffer_;
71
- };
72
-
73
- template <class Output> void ReadCount(util::FilePiece &in_file, Output &out) {
74
- try {
75
- while (true) {
76
- StringPiece line = in_file.ReadLine();
77
- util::TokenIter<util::SingleCharacter> tabber(line, '\t');
78
- if (!tabber) {
79
- std::cerr << "Warning: empty n-gram count line being removed\n";
80
- continue;
81
- }
82
- out.AddNGram(*tabber, line);
83
- }
84
- } catch (const util::EndOfFileException &e) {}
85
- }
86
-
87
- } // namespace lm
88
-
89
- #endif // LM_FILTER_COUNT_IO_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/filter/format.hh DELETED
@@ -1,250 +0,0 @@
1
- #ifndef LM_FILTER_FORMAT_H
2
- #define LM_FILTER_FORMAT_H
3
-
4
- #include "lm/filter/arpa_io.hh"
5
- #include "lm/filter/count_io.hh"
6
-
7
- #include <boost/lexical_cast.hpp>
8
- #include <boost/ptr_container/ptr_vector.hpp>
9
-
10
- #include <iosfwd>
11
-
12
- namespace lm {
13
-
14
- template <class Single> class MultipleOutput {
15
- private:
16
- typedef boost::ptr_vector<Single> Singles;
17
- typedef typename Singles::iterator SinglesIterator;
18
-
19
- public:
20
- MultipleOutput(const char *prefix, size_t number) {
21
- files_.reserve(number);
22
- std::string tmp;
23
- for (unsigned int i = 0; i < number; ++i) {
24
- tmp = prefix;
25
- tmp += boost::lexical_cast<std::string>(i);
26
- files_.push_back(new Single(tmp.c_str()));
27
- }
28
- }
29
-
30
- void AddNGram(const StringPiece &line) {
31
- for (SinglesIterator i = files_.begin(); i != files_.end(); ++i)
32
- i->AddNGram(line);
33
- }
34
-
35
- template <class Iterator> void AddNGram(const Iterator &begin, const Iterator &end, const StringPiece &line) {
36
- for (SinglesIterator i = files_.begin(); i != files_.end(); ++i)
37
- i->AddNGram(begin, end, line);
38
- }
39
-
40
- void SingleAddNGram(size_t offset, const StringPiece &line) {
41
- files_[offset].AddNGram(line);
42
- }
43
-
44
- template <class Iterator> void SingleAddNGram(size_t offset, const Iterator &begin, const Iterator &end, const StringPiece &line) {
45
- files_[offset].AddNGram(begin, end, line);
46
- }
47
-
48
- protected:
49
- Singles files_;
50
- };
51
-
52
- class MultipleARPAOutput : public MultipleOutput<ARPAOutput> {
53
- public:
54
- MultipleARPAOutput(const char *prefix, size_t number) : MultipleOutput<ARPAOutput>(prefix, number) {}
55
-
56
- void ReserveForCounts(std::streampos reserve) {
57
- for (boost::ptr_vector<ARPAOutput>::iterator i = files_.begin(); i != files_.end(); ++i)
58
- i->ReserveForCounts(reserve);
59
- }
60
-
61
- void BeginLength(unsigned int length) {
62
- for (boost::ptr_vector<ARPAOutput>::iterator i = files_.begin(); i != files_.end(); ++i)
63
- i->BeginLength(length);
64
- }
65
-
66
- void EndLength(unsigned int length) {
67
- for (boost::ptr_vector<ARPAOutput>::iterator i = files_.begin(); i != files_.end(); ++i)
68
- i->EndLength(length);
69
- }
70
-
71
- void Finish() {
72
- for (boost::ptr_vector<ARPAOutput>::iterator i = files_.begin(); i != files_.end(); ++i)
73
- i->Finish();
74
- }
75
- };
76
-
77
- template <class Filter, class Output> class DispatchInput {
78
- public:
79
- DispatchInput(Filter &filter, Output &output) : filter_(filter), output_(output) {}
80
-
81
- /* template <class Iterator> void AddNGram(const Iterator &begin, const Iterator &end, const StringPiece &line) {
82
- filter_.AddNGram(begin, end, line, output_);
83
- }*/
84
-
85
- void AddNGram(const StringPiece &ngram, const StringPiece &line) {
86
- filter_.AddNGram(ngram, line, output_);
87
- }
88
-
89
- protected:
90
- Filter &filter_;
91
- Output &output_;
92
- };
93
-
94
- template <class Filter, class Output> class DispatchARPAInput : public DispatchInput<Filter, Output> {
95
- private:
96
- typedef DispatchInput<Filter, Output> B;
97
-
98
- public:
99
- DispatchARPAInput(Filter &filter, Output &output) : B(filter, output) {}
100
-
101
- void ReserveForCounts(std::streampos reserve) { B::output_.ReserveForCounts(reserve); }
102
- void BeginLength(unsigned int length) { B::output_.BeginLength(length); }
103
-
104
- void EndLength(unsigned int length) {
105
- B::filter_.Flush();
106
- B::output_.EndLength(length);
107
- }
108
- void Finish() { B::output_.Finish(); }
109
- };
110
-
111
- struct ARPAFormat {
112
- typedef ARPAOutput Output;
113
- typedef MultipleARPAOutput Multiple;
114
- static void Copy(util::FilePiece &in, Output &out) {
115
- ReadARPA(in, out);
116
- }
117
- template <class Filter, class Out> static void RunFilter(util::FilePiece &in, Filter &filter, Out &output) {
118
- DispatchARPAInput<Filter, Out> dispatcher(filter, output);
119
- ReadARPA(in, dispatcher);
120
- }
121
- };
122
-
123
- struct CountFormat {
124
- typedef CountOutput Output;
125
- typedef MultipleOutput<Output> Multiple;
126
- static void Copy(util::FilePiece &in, Output &out) {
127
- ReadCount(in, out);
128
- }
129
- template <class Filter, class Out> static void RunFilter(util::FilePiece &in, Filter &filter, Out &output) {
130
- DispatchInput<Filter, Out> dispatcher(filter, output);
131
- ReadCount(in, dispatcher);
132
- }
133
- };
134
-
135
- /* For multithreading, the buffer classes hold batches of filter inputs and
136
- * outputs in memory. The strings get reused a lot, so keep them around
137
- * instead of clearing each time.
138
- */
139
- class InputBuffer {
140
- public:
141
- InputBuffer() : actual_(0) {}
142
-
143
- void Reserve(size_t size) { lines_.reserve(size); }
144
-
145
- template <class Output> void AddNGram(const StringPiece &ngram, const StringPiece &line, Output &output) {
146
- if (lines_.size() == actual_) lines_.resize(lines_.size() + 1);
147
- // TODO avoid this copy.
148
- std::string &copied = lines_[actual_].line;
149
- copied.assign(line.data(), line.size());
150
- lines_[actual_].ngram.set(copied.data() + (ngram.data() - line.data()), ngram.size());
151
- ++actual_;
152
- }
153
-
154
- template <class Filter, class Output> void CallFilter(Filter &filter, Output &output) const {
155
- for (std::vector<Line>::const_iterator i = lines_.begin(); i != lines_.begin() + actual_; ++i) {
156
- filter.AddNGram(i->ngram, i->line, output);
157
- }
158
- }
159
-
160
- void Clear() { actual_ = 0; }
161
- bool Empty() { return actual_ == 0; }
162
- size_t Size() { return actual_; }
163
-
164
- private:
165
- struct Line {
166
- std::string line;
167
- StringPiece ngram;
168
- };
169
-
170
- size_t actual_;
171
-
172
- std::vector<Line> lines_;
173
- };
174
-
175
- class BinaryOutputBuffer {
176
- public:
177
- BinaryOutputBuffer() {}
178
-
179
- void Reserve(size_t size) {
180
- lines_.reserve(size);
181
- }
182
-
183
- void AddNGram(const StringPiece &line) {
184
- lines_.push_back(line);
185
- }
186
-
187
- template <class Output> void Flush(Output &output) {
188
- for (std::vector<StringPiece>::const_iterator i = lines_.begin(); i != lines_.end(); ++i) {
189
- output.AddNGram(*i);
190
- }
191
- lines_.clear();
192
- }
193
-
194
- private:
195
- std::vector<StringPiece> lines_;
196
- };
197
-
198
- class MultipleOutputBuffer {
199
- public:
200
- MultipleOutputBuffer() : last_(NULL) {}
201
-
202
- void Reserve(size_t size) {
203
- annotated_.reserve(size);
204
- }
205
-
206
- void AddNGram(const StringPiece &line) {
207
- annotated_.resize(annotated_.size() + 1);
208
- annotated_.back().line = line;
209
- }
210
-
211
- void SingleAddNGram(size_t offset, const StringPiece &line) {
212
- if ((line.data() == last_.data()) && (line.length() == last_.length())) {
213
- annotated_.back().systems.push_back(offset);
214
- } else {
215
- annotated_.resize(annotated_.size() + 1);
216
- annotated_.back().systems.push_back(offset);
217
- annotated_.back().line = line;
218
- last_ = line;
219
- }
220
- }
221
-
222
- template <class Output> void Flush(Output &output) {
223
- for (std::vector<Annotated>::const_iterator i = annotated_.begin(); i != annotated_.end(); ++i) {
224
- if (i->systems.empty()) {
225
- output.AddNGram(i->line);
226
- } else {
227
- for (std::vector<size_t>::const_iterator j = i->systems.begin(); j != i->systems.end(); ++j) {
228
- output.SingleAddNGram(*j, i->line);
229
- }
230
- }
231
- }
232
- annotated_.clear();
233
- }
234
-
235
- private:
236
- struct Annotated {
237
- // If this is empty, send to all systems.
238
- // A filter should never send to all systems and send to a single one.
239
- std::vector<size_t> systems;
240
- StringPiece line;
241
- };
242
-
243
- StringPiece last_;
244
-
245
- std::vector<Annotated> annotated_;
246
- };
247
-
248
- } // namespace lm
249
-
250
- #endif // LM_FILTER_FORMAT_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/filter/phrase.hh DELETED
@@ -1,168 +0,0 @@
1
- #ifndef LM_FILTER_PHRASE_H
2
- #define LM_FILTER_PHRASE_H
3
-
4
- #include "util/murmur_hash.hh"
5
- #include "util/string_piece.hh"
6
- #include "util/tokenize_piece.hh"
7
-
8
- #include <boost/unordered_map.hpp>
9
-
10
- #include <iosfwd>
11
- #include <vector>
12
-
13
- #define LM_FILTER_PHRASE_METHOD(caps, lower) \
14
- bool Find##caps(Hash key, const std::vector<unsigned int> *&out) const {\
15
- Table::const_iterator i(table_.find(key));\
16
- if (i==table_.end()) return false; \
17
- out = &i->second.lower; \
18
- return true; \
19
- }
20
-
21
- namespace lm {
22
- namespace phrase {
23
-
24
- typedef uint64_t Hash;
25
-
26
- class Substrings {
27
- private:
28
- /* This is the value in a hash table where the key is a string. It indicates
29
- * four sets of sentences:
30
- * substring is sentences with a phrase containing the key as a substring.
31
- * left is sentencess with a phrase that begins with the key (left aligned).
32
- * right is sentences with a phrase that ends with the key (right aligned).
33
- * phrase is sentences where the key is a phrase.
34
- * Each set is encoded as a vector of sentence ids in increasing order.
35
- */
36
- struct SentenceRelation {
37
- std::vector<unsigned int> substring, left, right, phrase;
38
- };
39
- /* Most of the CPU is hash table lookups, so let's not complicate it with
40
- * vector equality comparisons. If a collision happens, the SentenceRelation
41
- * structure will contain the union of sentence ids over the colliding strings.
42
- * In that case, the filter will be slightly more permissive.
43
- * The key here is the same as boost's hash of std::vector<std::string>.
44
- */
45
- typedef boost::unordered_map<Hash, SentenceRelation> Table;
46
-
47
- public:
48
- Substrings() {}
49
-
50
- /* If the string isn't a substring of any phrase, return NULL. Otherwise,
51
- * return a pointer to std::vector<unsigned int> listing sentences with
52
- * matching phrases. This set may be empty for Left, Right, or Phrase.
53
- * Example: const std::vector<unsigned int> *FindSubstring(Hash key)
54
- */
55
- LM_FILTER_PHRASE_METHOD(Substring, substring)
56
- LM_FILTER_PHRASE_METHOD(Left, left)
57
- LM_FILTER_PHRASE_METHOD(Right, right)
58
- LM_FILTER_PHRASE_METHOD(Phrase, phrase)
59
-
60
- #pragma GCC diagnostic ignored "-Wuninitialized" // end != finish so there's always an initialization
61
- // sentence_id must be non-decreasing. Iterators are over words in the phrase.
62
- template <class Iterator> void AddPhrase(unsigned int sentence_id, const Iterator &begin, const Iterator &end) {
63
- // Iterate over all substrings.
64
- for (Iterator start = begin; start != end; ++start) {
65
- Hash hash = 0;
66
- SentenceRelation *relation;
67
- for (Iterator finish = start; finish != end; ++finish) {
68
- hash = util::MurmurHashNative(&hash, sizeof(uint64_t), *finish);
69
- // Now hash is of [start, finish].
70
- relation = &table_[hash];
71
- AppendSentence(relation->substring, sentence_id);
72
- if (start == begin) AppendSentence(relation->left, sentence_id);
73
- }
74
- AppendSentence(relation->right, sentence_id);
75
- if (start == begin) AppendSentence(relation->phrase, sentence_id);
76
- }
77
- }
78
-
79
- private:
80
- void AppendSentence(std::vector<unsigned int> &vec, unsigned int sentence_id) {
81
- if (vec.empty() || vec.back() != sentence_id) vec.push_back(sentence_id);
82
- }
83
-
84
- Table table_;
85
- };
86
-
87
- // Read a file with one sentence per line containing tab-delimited phrases of
88
- // space-separated words.
89
- unsigned int ReadMultiple(std::istream &in, Substrings &out);
90
-
91
- namespace detail {
92
- extern const StringPiece kEndSentence;
93
-
94
- template <class Iterator> void MakeHashes(Iterator i, const Iterator &end, std::vector<Hash> &hashes) {
95
- hashes.clear();
96
- if (i == end) return;
97
- // TODO: check strict phrase boundaries after <s> and before </s>. For now, just skip tags.
98
- if ((i->data()[0] == '<') && (i->data()[i->size() - 1] == '>')) {
99
- ++i;
100
- }
101
- for (; i != end && (*i != kEndSentence); ++i) {
102
- hashes.push_back(util::MurmurHashNative(i->data(), i->size()));
103
- }
104
- }
105
-
106
- class Vertex;
107
- class Arc;
108
-
109
- class ConditionCommon {
110
- protected:
111
- ConditionCommon(const Substrings &substrings);
112
- ConditionCommon(const ConditionCommon &from);
113
-
114
- ~ConditionCommon();
115
-
116
- detail::Vertex &MakeGraph();
117
-
118
- // Temporaries in PassNGram and Evaluate to avoid reallocation.
119
- std::vector<Hash> hashes_;
120
-
121
- private:
122
- std::vector<detail::Vertex> vertices_;
123
- std::vector<detail::Arc> arcs_;
124
-
125
- const Substrings &substrings_;
126
- };
127
-
128
- } // namespace detail
129
-
130
- class Union : public detail::ConditionCommon {
131
- public:
132
- explicit Union(const Substrings &substrings) : detail::ConditionCommon(substrings) {}
133
-
134
- template <class Iterator> bool PassNGram(const Iterator &begin, const Iterator &end) {
135
- detail::MakeHashes(begin, end, hashes_);
136
- return hashes_.empty() || Evaluate();
137
- }
138
-
139
- private:
140
- bool Evaluate();
141
- };
142
-
143
- class Multiple : public detail::ConditionCommon {
144
- public:
145
- explicit Multiple(const Substrings &substrings) : detail::ConditionCommon(substrings) {}
146
-
147
- template <class Iterator, class Output> void AddNGram(const Iterator &begin, const Iterator &end, const StringPiece &line, Output &output) {
148
- detail::MakeHashes(begin, end, hashes_);
149
- if (hashes_.empty()) {
150
- output.AddNGram(line);
151
- } else {
152
- Evaluate(line, output);
153
- }
154
- }
155
-
156
- template <class Output> void AddNGram(const StringPiece &ngram, const StringPiece &line, Output &output) {
157
- AddNGram(util::TokenIter<util::SingleCharacter, true>(ngram, ' '), util::TokenIter<util::SingleCharacter, true>::end(), line, output);
158
- }
159
-
160
- void Flush() const {}
161
-
162
- private:
163
- template <class Output> void Evaluate(const StringPiece &line, Output &output);
164
- };
165
-
166
- } // namespace phrase
167
- } // namespace lm
168
- #endif // LM_FILTER_PHRASE_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/filter/thread.hh DELETED
@@ -1,167 +0,0 @@
1
- #ifndef LM_FILTER_THREAD_H
2
- #define LM_FILTER_THREAD_H
3
-
4
- #include "util/thread_pool.hh"
5
-
6
- #include <boost/utility/in_place_factory.hpp>
7
-
8
- #include <deque>
9
- #include <stack>
10
-
11
- namespace lm {
12
-
13
- template <class OutputBuffer> class ThreadBatch {
14
- public:
15
- ThreadBatch() {}
16
-
17
- void Reserve(size_t size) {
18
- input_.Reserve(size);
19
- output_.Reserve(size);
20
- }
21
-
22
- // File reading thread.
23
- InputBuffer &Fill(uint64_t sequence) {
24
- sequence_ = sequence;
25
- // Why wait until now to clear instead of after output? free in the same
26
- // thread as allocated.
27
- input_.Clear();
28
- return input_;
29
- }
30
-
31
- // Filter worker thread.
32
- template <class Filter> void CallFilter(Filter &filter) {
33
- input_.CallFilter(filter, output_);
34
- }
35
-
36
- uint64_t Sequence() const { return sequence_; }
37
-
38
- // File writing thread.
39
- template <class RealOutput> void Flush(RealOutput &output) {
40
- output_.Flush(output);
41
- }
42
-
43
- private:
44
- InputBuffer input_;
45
- OutputBuffer output_;
46
-
47
- uint64_t sequence_;
48
- };
49
-
50
- template <class Batch, class Filter> class FilterWorker {
51
- public:
52
- typedef Batch *Request;
53
-
54
- FilterWorker(const Filter &filter, util::PCQueue<Request> &done) : filter_(filter), done_(done) {}
55
-
56
- void operator()(Request request) {
57
- request->CallFilter(filter_);
58
- done_.Produce(request);
59
- }
60
-
61
- private:
62
- Filter filter_;
63
-
64
- util::PCQueue<Request> &done_;
65
- };
66
-
67
- // There should only be one OutputWorker.
68
- template <class Batch, class Output> class OutputWorker {
69
- public:
70
- typedef Batch *Request;
71
-
72
- OutputWorker(Output &output, util::PCQueue<Request> &done) : output_(output), done_(done), base_sequence_(0) {}
73
-
74
- void operator()(Request request) {
75
- assert(request->Sequence() >= base_sequence_);
76
- // Assemble the output in order.
77
- uint64_t pos = request->Sequence() - base_sequence_;
78
- if (pos >= ordering_.size()) {
79
- ordering_.resize(pos + 1, NULL);
80
- }
81
- ordering_[pos] = request;
82
- while (!ordering_.empty() && ordering_.front()) {
83
- ordering_.front()->Flush(output_);
84
- done_.Produce(ordering_.front());
85
- ordering_.pop_front();
86
- ++base_sequence_;
87
- }
88
- }
89
-
90
- private:
91
- Output &output_;
92
-
93
- util::PCQueue<Request> &done_;
94
-
95
- std::deque<Request> ordering_;
96
-
97
- uint64_t base_sequence_;
98
- };
99
-
100
- template <class Filter, class OutputBuffer, class RealOutput> class Controller : boost::noncopyable {
101
- private:
102
- typedef ThreadBatch<OutputBuffer> Batch;
103
-
104
- public:
105
- Controller(size_t batch_size, size_t queue, size_t workers, const Filter &filter, RealOutput &output)
106
- : batch_size_(batch_size), queue_size_(queue),
107
- batches_(queue),
108
- to_read_(queue),
109
- output_(queue, 1, boost::in_place(boost::ref(output), boost::ref(to_read_)), NULL),
110
- filter_(queue, workers, boost::in_place(boost::ref(filter), boost::ref(output_.In())), NULL),
111
- sequence_(0) {
112
- for (size_t i = 0; i < queue; ++i) {
113
- batches_[i].Reserve(batch_size);
114
- local_read_.push(&batches_[i]);
115
- }
116
- NewInput();
117
- }
118
-
119
- void AddNGram(const StringPiece &ngram, const StringPiece &line, RealOutput &output) {
120
- input_->AddNGram(ngram, line, output);
121
- if (input_->Size() == batch_size_) {
122
- FlushInput();
123
- NewInput();
124
- }
125
- }
126
-
127
- void Flush() {
128
- FlushInput();
129
- while (local_read_.size() < queue_size_) {
130
- MoveRead();
131
- }
132
- NewInput();
133
- }
134
-
135
- private:
136
- void FlushInput() {
137
- if (input_->Empty()) return;
138
- filter_.Produce(local_read_.top());
139
- local_read_.pop();
140
- if (local_read_.empty()) MoveRead();
141
- }
142
-
143
- void NewInput() {
144
- input_ = &local_read_.top()->Fill(sequence_++);
145
- }
146
-
147
- void MoveRead() {
148
- local_read_.push(to_read_.Consume());
149
- }
150
-
151
- const size_t batch_size_;
152
- const size_t queue_size_;
153
-
154
- std::vector<Batch> batches_;
155
-
156
- util::PCQueue<Batch*> to_read_;
157
- std::stack<Batch*> local_read_;
158
- util::ThreadPool<OutputWorker<Batch, RealOutput> > output_;
159
- util::ThreadPool<FilterWorker<Batch, Filter> > filter_;
160
-
161
- uint64_t sequence_;
162
- InputBuffer *input_;
163
- };
164
-
165
- } // namespace lm
166
-
167
- #endif // LM_FILTER_THREAD_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/filter/vocab.hh DELETED
@@ -1,133 +0,0 @@
1
- #ifndef LM_FILTER_VOCAB_H
2
- #define LM_FILTER_VOCAB_H
3
-
4
- // Vocabulary-based filters for language models.
5
-
6
- #include "util/multi_intersection.hh"
7
- #include "util/string_piece.hh"
8
- #include "util/string_piece_hash.hh"
9
- #include "util/tokenize_piece.hh"
10
-
11
- #include <boost/noncopyable.hpp>
12
- #include <boost/range/iterator_range.hpp>
13
- #include <boost/unordered/unordered_map.hpp>
14
- #include <boost/unordered/unordered_set.hpp>
15
-
16
- #include <string>
17
- #include <vector>
18
-
19
- namespace lm {
20
- namespace vocab {
21
-
22
- void ReadSingle(std::istream &in, boost::unordered_set<std::string> &out);
23
-
24
- // Read one sentence vocabulary per line. Return the number of sentences.
25
- unsigned int ReadMultiple(std::istream &in, boost::unordered_map<std::string, std::vector<unsigned int> > &out);
26
-
27
- /* Is this a special tag like <s> or <UNK>? This actually includes anything
28
- * surrounded with < and >, which most tokenizers separate for real words, so
29
- * this should not catch real words as it looks at a single token.
30
- */
31
- inline bool IsTag(const StringPiece &value) {
32
- // The parser should never give an empty string.
33
- assert(!value.empty());
34
- return (value.data()[0] == '<' && value.data()[value.size() - 1] == '>');
35
- }
36
-
37
- class Single {
38
- public:
39
- typedef boost::unordered_set<std::string> Words;
40
-
41
- explicit Single(const Words &vocab) : vocab_(vocab) {}
42
-
43
- template <class Iterator> bool PassNGram(const Iterator &begin, const Iterator &end) {
44
- for (Iterator i = begin; i != end; ++i) {
45
- if (IsTag(*i)) continue;
46
- if (FindStringPiece(vocab_, *i) == vocab_.end()) return false;
47
- }
48
- return true;
49
- }
50
-
51
- private:
52
- const Words &vocab_;
53
- };
54
-
55
- class Union {
56
- public:
57
- typedef boost::unordered_map<std::string, std::vector<unsigned int> > Words;
58
-
59
- explicit Union(const Words &vocabs) : vocabs_(vocabs) {}
60
-
61
- template <class Iterator> bool PassNGram(const Iterator &begin, const Iterator &end) {
62
- sets_.clear();
63
-
64
- for (Iterator i(begin); i != end; ++i) {
65
- if (IsTag(*i)) continue;
66
- Words::const_iterator found(FindStringPiece(vocabs_, *i));
67
- if (vocabs_.end() == found) return false;
68
- sets_.push_back(boost::iterator_range<const unsigned int*>(&*found->second.begin(), &*found->second.end()));
69
- }
70
- return (sets_.empty() || util::FirstIntersection(sets_));
71
- }
72
-
73
- private:
74
- const Words &vocabs_;
75
-
76
- std::vector<boost::iterator_range<const unsigned int*> > sets_;
77
- };
78
-
79
- class Multiple {
80
- public:
81
- typedef boost::unordered_map<std::string, std::vector<unsigned int> > Words;
82
-
83
- Multiple(const Words &vocabs) : vocabs_(vocabs) {}
84
-
85
- private:
86
- // Callback from AllIntersection that does AddNGram.
87
- template <class Output> class Callback {
88
- public:
89
- Callback(Output &out, const StringPiece &line) : out_(out), line_(line) {}
90
-
91
- void operator()(unsigned int index) {
92
- out_.SingleAddNGram(index, line_);
93
- }
94
-
95
- private:
96
- Output &out_;
97
- const StringPiece &line_;
98
- };
99
-
100
- public:
101
- template <class Iterator, class Output> void AddNGram(const Iterator &begin, const Iterator &end, const StringPiece &line, Output &output) {
102
- sets_.clear();
103
- for (Iterator i(begin); i != end; ++i) {
104
- if (IsTag(*i)) continue;
105
- Words::const_iterator found(FindStringPiece(vocabs_, *i));
106
- if (vocabs_.end() == found) return;
107
- sets_.push_back(boost::iterator_range<const unsigned int*>(&*found->second.begin(), &*found->second.end()));
108
- }
109
- if (sets_.empty()) {
110
- output.AddNGram(line);
111
- return;
112
- }
113
-
114
- Callback<Output> cb(output, line);
115
- util::AllIntersection(sets_, cb);
116
- }
117
-
118
- template <class Output> void AddNGram(const StringPiece &ngram, const StringPiece &line, Output &output) {
119
- AddNGram(util::TokenIter<util::SingleCharacter, true>(ngram, ' '), util::TokenIter<util::SingleCharacter, true>::end(), line, output);
120
- }
121
-
122
- void Flush() const {}
123
-
124
- private:
125
- const Words &vocabs_;
126
-
127
- std::vector<boost::iterator_range<const unsigned int*> > sets_;
128
- };
129
-
130
- } // namespace vocab
131
- } // namespace lm
132
-
133
- #endif // LM_FILTER_VOCAB_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/filter/wrapper.hh DELETED
@@ -1,56 +0,0 @@
1
- #ifndef LM_FILTER_WRAPPER_H
2
- #define LM_FILTER_WRAPPER_H
3
-
4
- #include "util/string_piece.hh"
5
-
6
- #include <algorithm>
7
- #include <string>
8
- #include <vector>
9
-
10
- namespace lm {
11
-
12
- // Provide a single-output filter with the same interface as a
13
- // multiple-output filter so clients code against one interface.
14
- template <class Binary> class BinaryFilter {
15
- public:
16
- // Binary modes are just references (and a set) and it makes the API cleaner to copy them.
17
- explicit BinaryFilter(Binary binary) : binary_(binary) {}
18
-
19
- template <class Iterator, class Output> void AddNGram(const Iterator &begin, const Iterator &end, const StringPiece &line, Output &output) {
20
- if (binary_.PassNGram(begin, end))
21
- output.AddNGram(line);
22
- }
23
-
24
- template <class Output> void AddNGram(const StringPiece &ngram, const StringPiece &line, Output &output) {
25
- AddNGram(util::TokenIter<util::SingleCharacter, true>(ngram, ' '), util::TokenIter<util::SingleCharacter, true>::end(), line, output);
26
- }
27
-
28
- void Flush() const {}
29
-
30
- private:
31
- Binary binary_;
32
- };
33
-
34
- // Wrap another filter to pay attention only to context words
35
- template <class FilterT> class ContextFilter {
36
- public:
37
- typedef FilterT Filter;
38
-
39
- explicit ContextFilter(Filter &backend) : backend_(backend) {}
40
-
41
- template <class Output> void AddNGram(const StringPiece &ngram, const StringPiece &line, Output &output) {
42
- // Find beginning of string or last space.
43
- const char *last_space;
44
- for (last_space = ngram.data() + ngram.size() - 1; last_space > ngram.data() && *last_space != ' '; --last_space) {}
45
- backend_.AddNGram(StringPiece(ngram.data(), last_space - ngram.data()), line, output);
46
- }
47
-
48
- void Flush() const {}
49
-
50
- private:
51
- Filter backend_;
52
- };
53
-
54
- } // namespace lm
55
-
56
- #endif // LM_FILTER_WRAPPER_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/interpolate/arpa_to_stream.hh DELETED
@@ -1,38 +0,0 @@
1
- #include "lm/read_arpa.hh"
2
- #include "util/file_piece.hh"
3
-
4
- #include <vector>
5
-
6
- #include <stdint.h>
7
-
8
- namespace util { namespace stream { class ChainPositions; } }
9
-
10
- namespace lm {
11
-
12
- namespace ngram {
13
- template <class T> class GrowableVocab;
14
- class WriteUniqueWords;
15
- } // namespace ngram
16
-
17
- namespace interpolate {
18
-
19
- class ARPAToStream {
20
- public:
21
- // Takes ownership of fd.
22
- explicit ARPAToStream(int fd, ngram::GrowableVocab<ngram::WriteUniqueWords> &vocab);
23
-
24
- std::size_t Order() const { return counts_.size(); }
25
-
26
- const std::vector<uint64_t> &Counts() const { return counts_; }
27
-
28
- void Run(const util::stream::ChainPositions &positions);
29
-
30
- private:
31
- util::FilePiece in_;
32
-
33
- std::vector<uint64_t> counts_;
34
-
35
- ngram::GrowableVocab<ngram::WriteUniqueWords> &vocab_;
36
- };
37
-
38
- }} // namespaces
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/left.hh DELETED
@@ -1,216 +0,0 @@
1
- /* Efficient left and right language model state for sentence fragments.
2
- * Intended usage:
3
- * Store ChartState with every chart entry.
4
- * To do a rule application:
5
- * 1. Make a ChartState object for your new entry.
6
- * 2. Construct RuleScore.
7
- * 3. Going from left to right, call Terminal or NonTerminal.
8
- * For terminals, just pass the vocab id.
9
- * For non-terminals, pass that non-terminal's ChartState.
10
- * If your decoder expects scores inclusive of subtree scores (i.e. you
11
- * label entries with the highest-scoring path), pass the non-terminal's
12
- * score as prob.
13
- * If your decoder expects relative scores and will walk the chart later,
14
- * pass prob = 0.0.
15
- * In other words, the only effect of prob is that it gets added to the
16
- * returned log probability.
17
- * 4. Call Finish. It returns the log probability.
18
- *
19
- * There's a couple more details:
20
- * Do not pass <s> to Terminal as it is formally not a word in the sentence,
21
- * only context. Instead, call BeginSentence. If called, it should be the
22
- * first call after RuleScore is constructed (since <s> is always the
23
- * leftmost).
24
- *
25
- * If the leftmost RHS is a non-terminal, it's faster to call BeginNonTerminal.
26
- *
27
- * Hashing and sorting comparison operators are provided. All state objects
28
- * are POD. If you intend to use memcmp on raw state objects, you must call
29
- * ZeroRemaining first, as the value of array entries beyond length is
30
- * otherwise undefined.
31
- *
32
- * Usage is of course not limited to chart decoding. Anything that generates
33
- * sentence fragments missing left context could benefit. For example, a
34
- * phrase-based decoder could pre-score phrases, storing ChartState with each
35
- * phrase, even if hypotheses are generated left-to-right.
36
- */
37
-
38
- #ifndef LM_LEFT_H
39
- #define LM_LEFT_H
40
-
41
- #include "lm/max_order.hh"
42
- #include "lm/state.hh"
43
- #include "lm/return.hh"
44
-
45
- #include "util/murmur_hash.hh"
46
-
47
- #include <algorithm>
48
-
49
- namespace lm {
50
- namespace ngram {
51
-
52
- template <class M> class RuleScore {
53
- public:
54
- explicit RuleScore(const M &model, ChartState &out) : model_(model), out_(&out), left_done_(false), prob_(0.0) {
55
- out.left.length = 0;
56
- out.right.length = 0;
57
- }
58
-
59
- void BeginSentence() {
60
- out_->right = model_.BeginSentenceState();
61
- // out_->left is empty.
62
- left_done_ = true;
63
- }
64
-
65
- void Terminal(WordIndex word) {
66
- State copy(out_->right);
67
- FullScoreReturn ret(model_.FullScore(copy, word, out_->right));
68
- if (left_done_) { prob_ += ret.prob; return; }
69
- if (ret.independent_left) {
70
- prob_ += ret.prob;
71
- left_done_ = true;
72
- return;
73
- }
74
- out_->left.pointers[out_->left.length++] = ret.extend_left;
75
- prob_ += ret.rest;
76
- if (out_->right.length != copy.length + 1)
77
- left_done_ = true;
78
- }
79
-
80
- // Faster version of NonTerminal for the case where the rule begins with a non-terminal.
81
- void BeginNonTerminal(const ChartState &in, float prob = 0.0) {
82
- prob_ = prob;
83
- *out_ = in;
84
- left_done_ = in.left.full;
85
- }
86
-
87
- void NonTerminal(const ChartState &in, float prob = 0.0) {
88
- prob_ += prob;
89
-
90
- if (!in.left.length) {
91
- if (in.left.full) {
92
- for (const float *i = out_->right.backoff; i < out_->right.backoff + out_->right.length; ++i) prob_ += *i;
93
- left_done_ = true;
94
- out_->right = in.right;
95
- }
96
- return;
97
- }
98
-
99
- if (!out_->right.length) {
100
- out_->right = in.right;
101
- if (left_done_) {
102
- prob_ += model_.UnRest(in.left.pointers, in.left.pointers + in.left.length, 1);
103
- return;
104
- }
105
- if (out_->left.length) {
106
- left_done_ = true;
107
- } else {
108
- out_->left = in.left;
109
- left_done_ = in.left.full;
110
- }
111
- return;
112
- }
113
-
114
- float backoffs[KENLM_MAX_ORDER - 1], backoffs2[KENLM_MAX_ORDER - 1];
115
- float *back = backoffs, *back2 = backoffs2;
116
- unsigned char next_use = out_->right.length;
117
-
118
- // First word
119
- if (ExtendLeft(in, next_use, 1, out_->right.backoff, back)) return;
120
-
121
- // Words after the first, so extending a bigram to begin with
122
- for (unsigned char extend_length = 2; extend_length <= in.left.length; ++extend_length) {
123
- if (ExtendLeft(in, next_use, extend_length, back, back2)) return;
124
- std::swap(back, back2);
125
- }
126
-
127
- if (in.left.full) {
128
- for (const float *i = back; i != back + next_use; ++i) prob_ += *i;
129
- left_done_ = true;
130
- out_->right = in.right;
131
- return;
132
- }
133
-
134
- // Right state was minimized, so it's already independent of the new words to the left.
135
- if (in.right.length < in.left.length) {
136
- out_->right = in.right;
137
- return;
138
- }
139
-
140
- // Shift exisiting words down.
141
- for (WordIndex *i = out_->right.words + next_use - 1; i >= out_->right.words; --i) {
142
- *(i + in.right.length) = *i;
143
- }
144
- // Add words from in.right.
145
- std::copy(in.right.words, in.right.words + in.right.length, out_->right.words);
146
- // Assemble backoff composed on the existing state's backoff followed by the new state's backoff.
147
- std::copy(in.right.backoff, in.right.backoff + in.right.length, out_->right.backoff);
148
- std::copy(back, back + next_use, out_->right.backoff + in.right.length);
149
- out_->right.length = in.right.length + next_use;
150
- }
151
-
152
- float Finish() {
153
- // A N-1-gram might extend left and right but we should still set full to true because it's an N-1-gram.
154
- out_->left.full = left_done_ || (out_->left.length == model_.Order() - 1);
155
- return prob_;
156
- }
157
-
158
- void Reset() {
159
- prob_ = 0.0;
160
- left_done_ = false;
161
- out_->left.length = 0;
162
- out_->right.length = 0;
163
- }
164
- void Reset(ChartState &replacement) {
165
- out_ = &replacement;
166
- Reset();
167
- }
168
-
169
- private:
170
- bool ExtendLeft(const ChartState &in, unsigned char &next_use, unsigned char extend_length, const float *back_in, float *back_out) {
171
- ProcessRet(model_.ExtendLeft(
172
- out_->right.words, out_->right.words + next_use, // Words to extend into
173
- back_in, // Backoffs to use
174
- in.left.pointers[extend_length - 1], extend_length, // Words to be extended
175
- back_out, // Backoffs for the next score
176
- next_use)); // Length of n-gram to use in next scoring.
177
- if (next_use != out_->right.length) {
178
- left_done_ = true;
179
- if (!next_use) {
180
- // Early exit.
181
- out_->right = in.right;
182
- prob_ += model_.UnRest(in.left.pointers + extend_length, in.left.pointers + in.left.length, extend_length + 1);
183
- return true;
184
- }
185
- }
186
- // Continue scoring.
187
- return false;
188
- }
189
-
190
- void ProcessRet(const FullScoreReturn &ret) {
191
- if (left_done_) {
192
- prob_ += ret.prob;
193
- return;
194
- }
195
- if (ret.independent_left) {
196
- prob_ += ret.prob;
197
- left_done_ = true;
198
- return;
199
- }
200
- out_->left.pointers[out_->left.length++] = ret.extend_left;
201
- prob_ += ret.rest;
202
- }
203
-
204
- const M &model_;
205
-
206
- ChartState *out_;
207
-
208
- bool left_done_;
209
-
210
- float prob_;
211
- };
212
-
213
- } // namespace ngram
214
- } // namespace lm
215
-
216
- #endif // LM_LEFT_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/lm_exception.hh DELETED
@@ -1,50 +0,0 @@
1
- #ifndef LM_LM_EXCEPTION_H
2
- #define LM_LM_EXCEPTION_H
3
-
4
- // Named to avoid conflict with util/exception.hh.
5
-
6
- #include "util/exception.hh"
7
- #include "util/string_piece.hh"
8
-
9
- #include <exception>
10
- #include <string>
11
-
12
- namespace lm {
13
-
14
- typedef enum {THROW_UP, COMPLAIN, SILENT} WarningAction;
15
-
16
- class ConfigException : public util::Exception {
17
- public:
18
- ConfigException() throw();
19
- ~ConfigException() throw();
20
- };
21
-
22
- class LoadException : public util::Exception {
23
- public:
24
- virtual ~LoadException() throw();
25
-
26
- protected:
27
- LoadException() throw();
28
- };
29
-
30
- class FormatLoadException : public LoadException {
31
- public:
32
- FormatLoadException() throw();
33
- ~FormatLoadException() throw();
34
- };
35
-
36
- class VocabLoadException : public LoadException {
37
- public:
38
- virtual ~VocabLoadException() throw();
39
- VocabLoadException() throw();
40
- };
41
-
42
- class SpecialWordMissingException : public VocabLoadException {
43
- public:
44
- explicit SpecialWordMissingException() throw();
45
- ~SpecialWordMissingException() throw();
46
- };
47
-
48
- } // namespace lm
49
-
50
- #endif // LM_LM_EXCEPTION
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/max_order.hh DELETED
@@ -1,13 +0,0 @@
1
- #ifndef LM_MAX_ORDER_H
2
- #define LM_MAX_ORDER_H
3
- /* IF YOUR BUILD SYSTEM PASSES -DKENLM_MAX_ORDER, THEN CHANGE THE BUILD SYSTEM.
4
- * If not, this is the default maximum order.
5
- * Having this limit means that State can be
6
- * (kMaxOrder - 1) * sizeof(float) bytes instead of
7
- * sizeof(float*) + (kMaxOrder - 1) * sizeof(float) + malloc overhead
8
- */
9
- #ifndef KENLM_ORDER_MESSAGE
10
- #define KENLM_ORDER_MESSAGE "If your build system supports changing KENLM_MAX_ORDER, change it there and recompile. In the KenLM tarball or Moses, use e.g. `bjam --max-kenlm-order=6 -a'. Otherwise, edit lm/max_order.hh."
11
- #endif
12
-
13
- #endif // LM_MAX_ORDER_H
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kenlm/include/lm/model.hh DELETED
@@ -1,156 +0,0 @@
1
- #ifndef LM_MODEL_H
2
- #define LM_MODEL_H
3
-
4
- #include "lm/bhiksha.hh"
5
- #include "lm/binary_format.hh"
6
- #include "lm/config.hh"
7
- #include "lm/facade.hh"
8
- #include "lm/quantize.hh"
9
- #include "lm/search_hashed.hh"
10
- #include "lm/search_trie.hh"
11
- #include "lm/state.hh"
12
- #include "lm/value.hh"
13
- #include "lm/vocab.hh"
14
- #include "lm/weights.hh"
15
-
16
- #include "util/murmur_hash.hh"
17
-
18
- #include <algorithm>
19
- #include <vector>
20
-
21
- #include <string.h>
22
-
23
- namespace util { class FilePiece; }
24
-
25
- namespace lm {
26
- namespace ngram {
27
- namespace detail {
28
-
29
- // Should return the same results as SRI.
30
- // ModelFacade typedefs Vocabulary so we use VocabularyT to avoid naming conflicts.
31
- template <class Search, class VocabularyT> class GenericModel : public base::ModelFacade<GenericModel<Search, VocabularyT>, State, VocabularyT> {
32
- private:
33
- typedef base::ModelFacade<GenericModel<Search, VocabularyT>, State, VocabularyT> P;
34
- public:
35
- // This is the model type returned by RecognizeBinary.
36
- static const ModelType kModelType;
37
-
38
- static const unsigned int kVersion = Search::kVersion;
39
-
40
- /* Get the size of memory that will be mapped given ngram counts. This
41
- * does not include small non-mapped control structures, such as this class
42
- * itself.
43
- */
44
- static uint64_t Size(const std::vector<uint64_t> &counts, const Config &config = Config());
45
-
46
- /* Load the model from a file. It may be an ARPA or binary file. Binary
47
- * files must have the format expected by this class or you'll get an
48
- * exception. So TrieModel can only load ARPA or binary created by
49
- * TrieModel. To classify binary files, call RecognizeBinary in
50
- * lm/binary_format.hh.
51
- */
52
- explicit GenericModel(const char *file, const Config &config = Config());
53
-
54
- /* Score p(new_word | in_state) and incorporate new_word into out_state.
55
- * Note that in_state and out_state must be different references:
56
- * &in_state != &out_state.
57
- */
58
- FullScoreReturn FullScore(const State &in_state, const WordIndex new_word, State &out_state) const;
59
-
60
- /* Slower call without in_state. Try to remember state, but sometimes it
61
- * would cost too much memory or your decoder isn't setup properly.
62
- * To use this function, make an array of WordIndex containing the context
63
- * vocabulary ids in reverse order. Then, pass the bounds of the array:
64
- * [context_rbegin, context_rend). The new_word is not part of the context
65
- * array unless you intend to repeat words.
66
- */
67
- FullScoreReturn FullScoreForgotState(const WordIndex *context_rbegin, const WordIndex *context_rend, const WordIndex new_word, State &out_state) const;
68
-
69
- /* Get the state for a context. Don't use this if you can avoid it. Use
70
- * BeginSentenceState or NullContextState and extend from those. If
71
- * you're only going to use this state to call FullScore once, use
72
- * FullScoreForgotState.
73
- * To use this function, make an array of WordIndex containing the context
74
- * vocabulary ids in reverse order. Then, pass the bounds of the array:
75
- * [context_rbegin, context_rend).
76
- */
77
- void GetState(const WordIndex *context_rbegin, const WordIndex *context_rend, State &out_state) const;
78
-
79
- /* More efficient version of FullScore where a partial n-gram has already
80
- * been scored.
81
- * NOTE: THE RETURNED .rest AND .prob ARE RELATIVE TO THE .rest RETURNED BEFORE.
82
- */
83
- FullScoreReturn ExtendLeft(
84
- // Additional context in reverse order. This will update add_rend to
85
- const WordIndex *add_rbegin, const WordIndex *add_rend,
86
- // Backoff weights to use.
87
- const float *backoff_in,
88
- // extend_left returned by a previous query.
89
- uint64_t extend_pointer,
90
- // Length of n-gram that the pointer corresponds to.
91
- unsigned char extend_length,
92
- // Where to write additional backoffs for [extend_length + 1, min(Order() - 1, return.ngram_length)]
93
- float *backoff_out,
94
- // Amount of additional content that should be considered by the next call.
95
- unsigned char &next_use) const;
96
-
97
- /* Return probabilities minus rest costs for an array of pointers. The
98
- * first length should be the length of the n-gram to which pointers_begin
99
- * points.
100
- */
101
- float UnRest(const uint64_t *pointers_begin, const uint64_t *pointers_end, unsigned char first_length) const {
102
- // Compiler should optimize this if away.
103
- return Search::kDifferentRest ? InternalUnRest(pointers_begin, pointers_end, first_length) : 0.0;
104
- }
105
-
106
- private:
107
- FullScoreReturn ScoreExceptBackoff(const WordIndex *const context_rbegin, const WordIndex *const context_rend, const WordIndex new_word, State &out_state) const;
108
-
109
- // Score bigrams and above. Do not include backoff.
110
- void ResumeScore(const WordIndex *context_rbegin, const WordIndex *const context_rend, unsigned char starting_order_minus_2, typename Search::Node &node, float *backoff_out, unsigned char &next_use, FullScoreReturn &ret) const;
111
-
112
- // Appears after Size in the cc file.
113
- void SetupMemory(void *start, const std::vector<uint64_t> &counts, const Config &config);
114
-
115
- void InitializeFromARPA(int fd, const char *file, const Config &config);
116
-
117
- float InternalUnRest(const uint64_t *pointers_begin, const uint64_t *pointers_end, unsigned char first_length) const;
118
-
119
- BinaryFormat backing_;
120
-
121
- VocabularyT vocab_;
122
-
123
- Search search_;
124
- };
125
-
126
- } // namespace detail
127
-
128
- // Instead of typedef, inherit. This allows the Model etc to be forward declared.
129
- // Oh the joys of C and C++.
130
- #define LM_COMMA() ,
131
- #define LM_NAME_MODEL(name, from)\
132
- class name : public from {\
133
- public:\
134
- name(const char *file, const Config &config = Config()) : from(file, config) {}\
135
- };
136
-
137
- LM_NAME_MODEL(ProbingModel, detail::GenericModel<detail::HashedSearch<BackoffValue> LM_COMMA() ProbingVocabulary>);
138
- LM_NAME_MODEL(RestProbingModel, detail::GenericModel<detail::HashedSearch<RestValue> LM_COMMA() ProbingVocabulary>);
139
- LM_NAME_MODEL(TrieModel, detail::GenericModel<trie::TrieSearch<DontQuantize LM_COMMA() trie::DontBhiksha> LM_COMMA() SortedVocabulary>);
140
- LM_NAME_MODEL(ArrayTrieModel, detail::GenericModel<trie::TrieSearch<DontQuantize LM_COMMA() trie::ArrayBhiksha> LM_COMMA() SortedVocabulary>);
141
- LM_NAME_MODEL(QuantTrieModel, detail::GenericModel<trie::TrieSearch<SeparatelyQuantize LM_COMMA() trie::DontBhiksha> LM_COMMA() SortedVocabulary>);
142
- LM_NAME_MODEL(QuantArrayTrieModel, detail::GenericModel<trie::TrieSearch<SeparatelyQuantize LM_COMMA() trie::ArrayBhiksha> LM_COMMA() SortedVocabulary>);
143
-
144
- // Default implementation. No real reason for it to be the default.
145
- typedef ::lm::ngram::ProbingVocabulary Vocabulary;
146
- typedef ProbingModel Model;
147
-
148
- /* Autorecognize the file type, load, and return the virtual base class. Don't
149
- * use the virtual base class if you can avoid it. Instead, use the above
150
- * classes as template arguments to your own virtual feature function.*/
151
- base::Model *LoadVirtual(const char *file_name, const Config &config = Config(), ModelType if_arpa = PROBING);
152
-
153
- } // namespace ngram
154
- } // namespace lm
155
-
156
- #endif // LM_MODEL_H