-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #8, convert hunspell output to spellchecker JSON format #9
Open
teners
wants to merge
22
commits into
master
Choose a base branch
from
tkt_8_convert_hunspell_to_json
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7833457
Initial commit
a197b6e
Removed output file option, added corrections with spaces support,
ccada06
Fixed duplicates issue, comma-after-last-element issue,
d225ac5
Removed dummy sed solution for the last comma issue,
d1a31dd
Deleted shell script and readme, added gitignore for .idea stuff
768d0e2
Iniital commit for Java implementation
2429ed8
Merged something for some reason
f3f1597
Removed Java spellchecker implementation
1a2ee88
Initial commit for python grpc version
039864a
Deleted .pyc file and added that extension to gitignore
54a60d2
Added author's name, removed unneeded test.py
81adc92
Replaced json-string with typed interface in .proto file
77b1f9f
Added path to shared library as constructor argument in Parser
893fca6
Replaced json with protobuf interface, fixed small flaws
8c0e6fd
Fixed Suggestions interface in proto file
9e4af1a
Replaced all string literals with command line arguments, minor fixes
01d8e7a
Fixed docstring
9e79d4d
Reformatted parser.cpp
eb1d37e
Removed unused ujson import
d8aaff2
Added requirements.txt
9ae2d84
Moved new-hunspell-instance-initialization on request from check_text
a7e2db5
Removed "language" command line argument
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.pyc | ||
__pycache__ | ||
.idea | ||
libparser/build/* | ||
!libparser/build/Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
cmake_minimum_required(VERSION 3.2) | ||
project(parsers) | ||
|
||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lhunspell") | ||
|
||
set(SOURCE_FILES | ||
parsers/latexparser.cxx | ||
parsers/latexparser.hxx | ||
parsers/textparser.cxx | ||
parsers/textparser.hxx | ||
parser.cpp) | ||
|
||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/parsers) | ||
|
||
add_library(parser SHARED ${SOURCE_FILES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,238 @@ | ||
# CMAKE generated file: DO NOT EDIT! | ||
# Generated by "Unix Makefiles" Generator, CMake Version 3.6 | ||
|
||
# Default target executed when no arguments are given to make. | ||
default_target: all | ||
|
||
.PHONY : default_target | ||
|
||
# Allow only one "make -f Makefile2" at a time, but pass parallelism. | ||
.NOTPARALLEL: | ||
|
||
|
||
#============================================================================= | ||
# Special targets provided by cmake. | ||
|
||
# Disable implicit rules so canonical targets will work. | ||
.SUFFIXES: | ||
|
||
|
||
# Remove some rules from gmake that .SUFFIXES does not remove. | ||
SUFFIXES = | ||
|
||
.SUFFIXES: .hpux_make_needs_suffix_list | ||
|
||
|
||
# Suppress display of executed commands. | ||
$(VERBOSE).SILENT: | ||
|
||
|
||
# A target that is always out of date. | ||
cmake_force: | ||
|
||
.PHONY : cmake_force | ||
|
||
#============================================================================= | ||
# Set environment variables for the build. | ||
|
||
# The shell in which to execute make rules. | ||
SHELL = /bin/sh | ||
|
||
# The CMake executable. | ||
CMAKE_COMMAND = /usr/bin/cmake | ||
|
||
# The command to remove a file. | ||
RM = /usr/bin/cmake -E remove -f | ||
|
||
# Escaping for special characters. | ||
EQUALS = = | ||
|
||
# The top-level source directory on which CMake was run. | ||
CMAKE_SOURCE_DIR = /home/tener/git/papeeria/backend/spellchecker/libparser | ||
|
||
# The top-level build directory on which CMake was run. | ||
CMAKE_BINARY_DIR = /home/tener/git/papeeria/backend/spellchecker/libparser/build | ||
|
||
#============================================================================= | ||
# Targets provided globally by CMake. | ||
|
||
# Special rule for the target edit_cache | ||
edit_cache: | ||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." | ||
/usr/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) | ||
.PHONY : edit_cache | ||
|
||
# Special rule for the target edit_cache | ||
edit_cache/fast: edit_cache | ||
|
||
.PHONY : edit_cache/fast | ||
|
||
# Special rule for the target rebuild_cache | ||
rebuild_cache: | ||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." | ||
/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) | ||
.PHONY : rebuild_cache | ||
|
||
# Special rule for the target rebuild_cache | ||
rebuild_cache/fast: rebuild_cache | ||
|
||
.PHONY : rebuild_cache/fast | ||
|
||
# The main all target | ||
all: cmake_check_build_system | ||
$(CMAKE_COMMAND) -E cmake_progress_start /home/tener/git/papeeria/backend/spellchecker/libparser/build/CMakeFiles /home/tener/git/papeeria/backend/spellchecker/libparser/build/CMakeFiles/progress.marks | ||
$(MAKE) -f CMakeFiles/Makefile2 all | ||
$(CMAKE_COMMAND) -E cmake_progress_start /home/tener/git/papeeria/backend/spellchecker/libparser/build/CMakeFiles 0 | ||
.PHONY : all | ||
|
||
# The main clean target | ||
clean: | ||
$(MAKE) -f CMakeFiles/Makefile2 clean | ||
.PHONY : clean | ||
|
||
# The main clean target | ||
clean/fast: clean | ||
|
||
.PHONY : clean/fast | ||
|
||
# Prepare targets for installation. | ||
preinstall: all | ||
$(MAKE) -f CMakeFiles/Makefile2 preinstall | ||
.PHONY : preinstall | ||
|
||
# Prepare targets for installation. | ||
preinstall/fast: | ||
$(MAKE) -f CMakeFiles/Makefile2 preinstall | ||
.PHONY : preinstall/fast | ||
|
||
# clear depends | ||
depend: | ||
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 | ||
.PHONY : depend | ||
|
||
#============================================================================= | ||
# Target rules for targets named parser | ||
|
||
# Build rule for target. | ||
parser: cmake_check_build_system | ||
$(MAKE) -f CMakeFiles/Makefile2 parser | ||
.PHONY : parser | ||
|
||
# fast build rule for target. | ||
parser/fast: | ||
$(MAKE) -f CMakeFiles/parser.dir/build.make CMakeFiles/parser.dir/build | ||
.PHONY : parser/fast | ||
|
||
parser.o: parser.cpp.o | ||
|
||
.PHONY : parser.o | ||
|
||
# target to build an object file | ||
parser.cpp.o: | ||
$(MAKE) -f CMakeFiles/parser.dir/build.make CMakeFiles/parser.dir/parser.cpp.o | ||
.PHONY : parser.cpp.o | ||
|
||
parser.i: parser.cpp.i | ||
|
||
.PHONY : parser.i | ||
|
||
# target to preprocess a source file | ||
parser.cpp.i: | ||
$(MAKE) -f CMakeFiles/parser.dir/build.make CMakeFiles/parser.dir/parser.cpp.i | ||
.PHONY : parser.cpp.i | ||
|
||
parser.s: parser.cpp.s | ||
|
||
.PHONY : parser.s | ||
|
||
# target to generate assembly for a file | ||
parser.cpp.s: | ||
$(MAKE) -f CMakeFiles/parser.dir/build.make CMakeFiles/parser.dir/parser.cpp.s | ||
.PHONY : parser.cpp.s | ||
|
||
parsers/latexparser.o: parsers/latexparser.cxx.o | ||
|
||
.PHONY : parsers/latexparser.o | ||
|
||
# target to build an object file | ||
parsers/latexparser.cxx.o: | ||
$(MAKE) -f CMakeFiles/parser.dir/build.make CMakeFiles/parser.dir/parsers/latexparser.cxx.o | ||
.PHONY : parsers/latexparser.cxx.o | ||
|
||
parsers/latexparser.i: parsers/latexparser.cxx.i | ||
|
||
.PHONY : parsers/latexparser.i | ||
|
||
# target to preprocess a source file | ||
parsers/latexparser.cxx.i: | ||
$(MAKE) -f CMakeFiles/parser.dir/build.make CMakeFiles/parser.dir/parsers/latexparser.cxx.i | ||
.PHONY : parsers/latexparser.cxx.i | ||
|
||
parsers/latexparser.s: parsers/latexparser.cxx.s | ||
|
||
.PHONY : parsers/latexparser.s | ||
|
||
# target to generate assembly for a file | ||
parsers/latexparser.cxx.s: | ||
$(MAKE) -f CMakeFiles/parser.dir/build.make CMakeFiles/parser.dir/parsers/latexparser.cxx.s | ||
.PHONY : parsers/latexparser.cxx.s | ||
|
||
parsers/textparser.o: parsers/textparser.cxx.o | ||
|
||
.PHONY : parsers/textparser.o | ||
|
||
# target to build an object file | ||
parsers/textparser.cxx.o: | ||
$(MAKE) -f CMakeFiles/parser.dir/build.make CMakeFiles/parser.dir/parsers/textparser.cxx.o | ||
.PHONY : parsers/textparser.cxx.o | ||
|
||
parsers/textparser.i: parsers/textparser.cxx.i | ||
|
||
.PHONY : parsers/textparser.i | ||
|
||
# target to preprocess a source file | ||
parsers/textparser.cxx.i: | ||
$(MAKE) -f CMakeFiles/parser.dir/build.make CMakeFiles/parser.dir/parsers/textparser.cxx.i | ||
.PHONY : parsers/textparser.cxx.i | ||
|
||
parsers/textparser.s: parsers/textparser.cxx.s | ||
|
||
.PHONY : parsers/textparser.s | ||
|
||
# target to generate assembly for a file | ||
parsers/textparser.cxx.s: | ||
$(MAKE) -f CMakeFiles/parser.dir/build.make CMakeFiles/parser.dir/parsers/textparser.cxx.s | ||
.PHONY : parsers/textparser.cxx.s | ||
|
||
# Help Target | ||
help: | ||
@echo "The following are some of the valid targets for this Makefile:" | ||
@echo "... all (the default if no target is provided)" | ||
@echo "... clean" | ||
@echo "... depend" | ||
@echo "... edit_cache" | ||
@echo "... rebuild_cache" | ||
@echo "... parser" | ||
@echo "... parser.o" | ||
@echo "... parser.i" | ||
@echo "... parser.s" | ||
@echo "... parsers/latexparser.o" | ||
@echo "... parsers/latexparser.i" | ||
@echo "... parsers/latexparser.s" | ||
@echo "... parsers/textparser.o" | ||
@echo "... parsers/textparser.i" | ||
@echo "... parsers/textparser.s" | ||
.PHONY : help | ||
|
||
|
||
|
||
#============================================================================= | ||
# Special targets to cleanup operation of make. | ||
|
||
# Special rule to run CMake to check the build system integrity. | ||
# No rule that depends on this can have commands that come from listfiles | ||
# because they might be regenerated. | ||
cmake_check_build_system: | ||
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 | ||
.PHONY : cmake_check_build_system | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "parsers/latexparser.hxx" | ||
#include <cstring> | ||
#include <iostream> | ||
#include <assert.h> | ||
|
||
extern "C" { | ||
|
||
struct Token { | ||
char* token; | ||
}; | ||
|
||
std::string alphabet("qwertzuiopasdfghjklyxcvbnmQWERTZUIOPASDFGHJKLYXCVBNM"); | ||
|
||
LaTeXParser* latex_parser() { | ||
return new LaTeXParser(alphabet.c_str()); | ||
} | ||
|
||
void delete_parser(LaTeXParser *parser) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it your code as well? Please add author and format the code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, sure, forgot about that cpp stuff over there |
||
delete parser; | ||
} | ||
|
||
void put_line(LaTeXParser* parser, char* line) { | ||
parser->put_line(line); | ||
} | ||
|
||
int next_token(LaTeXParser *parser, Token *token) { | ||
parser->set_url_checking(true); | ||
std::string next; | ||
if (parser->next_token(next)) { | ||
token->token = new char[next.size()+1]; | ||
std::copy(next.begin(), next.end(), token->token); | ||
token->token[next.size()] = '\0'; | ||
return 1; | ||
} | ||
else { | ||
token->token = NULL; | ||
return 0; | ||
} | ||
} | ||
|
||
void free_token(Token *token) { | ||
if (token->token) { | ||
delete [] token->token; | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WTF?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I know, but for some reason latexparser needs alphabet as an argument of constructor. textparser (latexparser inherits it) has default constructor, btw, and this is the very string that initializes textparser's wordchar array (some inner stuff, I dunno).
Proof (textparser.cxx:126):