[refactor] do some works

- move gitignore in individual directories.
- change some directory layout.
- refactor NlpCodec but not finished.
This commit is contained in:
2024-12-08 23:33:57 +08:00
parent 8fa925d860
commit 52ea2745dd
25 changed files with 953 additions and 9548 deletions

42
NlpParser/.gitignore vendored Normal file
View File

@ -0,0 +1,42 @@
# ===== Custom =====
# Only preserve testbench in assets.
assets/*
!assets/testbench.txt
# ===== ANTLR Output =====
*.interp
*.tokens
Nlp*.java
# ===== Eclipse Java =====
# Eclipse projects
.classpath
.project
.settings/
.metadata
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

View File

@ -21,7 +21,7 @@ import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.nio.charset.Charset;
public class NlpRunner {
public class MainRunner {
public static class NlpJsonConverter extends NlpBaseListener {
public NlpJsonConverter() {
mGsonInstance = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
@ -148,7 +148,7 @@ public class NlpRunner {
}
private static void printHelp() {
System.out.println("NlpRunner <src> <dest>");
System.out.println("NlpParser <src> <dest>");
System.out.println();
System.out.println("<src> - the decoded nlp text file.");
System.out.println("<dest> - the output json file.");

View File

@ -8,9 +8,9 @@ Requirements:
Useful commands:
* `antlr4 Nlp.g4`: Analyze Antlr format file.
* `javac Nlp*.java`: Compile executable application.
* `javac *.java`: Compile executable application.
* Do testbench
- `grun Nlp document -tree < testbench.txt`
- `grun Nlp document -gui < testbench.txt`
- `java NlpRunner testbench.txt result.json`
- `java MainRunner testbench.txt out/result.json`