Skip to content

Commit

Permalink
fix: 修复生成jar模块问题
Browse files Browse the repository at this point in the history
  • Loading branch information
nl8590687 committed Mar 26, 2022
1 parent 9f78b5a commit 021f437
Show file tree
Hide file tree
Showing 23 changed files with 274 additions and 120 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/.metadata/
1 change: 1 addition & 0 deletions asrt_sdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.metadata/
17 changes: 0 additions & 17 deletions asrt_sdk/asrt_sdk.iml

This file was deleted.

12 changes: 0 additions & 12 deletions asrt_sdk/pom.xml

This file was deleted.

29 changes: 29 additions & 0 deletions asrt_sdk/sdk/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/gson-2.9.0.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
1 change: 1 addition & 0 deletions asrt_sdk/sdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
23 changes: 23 additions & 0 deletions asrt_sdk/sdk/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>sdk</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
4 changes: 4 additions & 0 deletions asrt_sdk/sdk/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8
8 changes: 8 additions & 0 deletions asrt_sdk/sdk/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.7
4 changes: 4 additions & 0 deletions asrt_sdk/sdk/.settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
77 changes: 77 additions & 0 deletions asrt_sdk/sdk/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>net.ailemon.asrt</groupId>
<artifactId>sdk</artifactId>
<version>0.0.1-SNAPSHOT</version>

<name>sdk</name>
<!-- FIXME change it to the project's website -->
<url>https://www.ailemon.net</url>


<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>

</plugins>
</pluginManagement>
</build>
</project>
13 changes: 13 additions & 0 deletions asrt_sdk/sdk/src/main/java/net/ailemon/asrt/sdk/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package net.ailemon.asrt.sdk;

/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package net.ailemon.asrt.sdk;

import AsrtApiModel.AsrtApiSpeechRequest;
import AsrtApiModel.AsrtApiLanguageRequest;
import AsrtApiModel.AsrtApiResponse;
import AsrtApiModel.Wave;
import common.Common;
import net.ailemon.asrt.sdk.models.AsrtApiSpeechRequest;
import net.ailemon.asrt.sdk.models.AsrtApiLanguageRequest;
import net.ailemon.asrt.sdk.models.AsrtApiResponse;
import net.ailemon.asrt.sdk.models.Wave;
import net.ailemon.asrt.sdk.common.Common;

public abstract class BaseSpeechRecognizer {
protected String host = "";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package net.ailemon.asrt.sdk;

import AsrtApiModel.AsrtApiSpeechRequest;
import AsrtApiModel.AsrtApiLanguageRequest;
import AsrtApiModel.AsrtApiResponse;
import common.Http;
import net.ailemon.asrt.sdk.models.AsrtApiSpeechRequest;
import net.ailemon.asrt.sdk.models.AsrtApiLanguageRequest;
import net.ailemon.asrt.sdk.models.AsrtApiResponse;
import net.ailemon.asrt.sdk.common.Http;

public class HttpSpeechRecognizer extends BaseSpeechRecognizer {
public String subPath = "";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import AsrtApiModel.AsrtApiResponse;
import common.Common;
package net.ailemon.asrt.sdk;

import net.ailemon.asrt.sdk.models.AsrtApiResponse;
import net.ailemon.asrt.sdk.common.Common;
import net.ailemon.asrt.sdk.models.Wave;

public class Sdk {
// GetSpeechRecognizer 获取一个ASRT语音识别类实例化对象
// GetSpeechRecognizer 鑾峰彇涓�涓狝SRT璇煶璇嗗埆绫诲疄渚嬪寲瀵硅薄
public static BaseSpeechRecognizer GetSpeechRecognizer(String host, String port, String protocol) {
if("http".equals(protocol) || "https".equals(protocol)){
return HttpSpeechRecognizer.newHttpSpeechRecognizer(host, port, protocol, "");
Expand All @@ -20,16 +23,16 @@ public static void main(String[] args) {
filename = args[0];
}
// ============================================
// 直接调用ASRT识别语音文件
// 鐩存帴璋冪敤ASRT璇嗗埆璇煶鏂囦欢
AsrtApiResponse rsp = sr.RecogniteFile(filename);
System.out.println(rsp.statusCode);
System.out.println(rsp.statusMessage);
System.out.println(rsp.result);

// ============================================
// 调用ASRT识别语音序列
// 璋冪敤ASRT璇嗗埆璇煶搴忓垪
byte[] wavBytes = Common.readBinFile(filename);
AsrtApiModel.Wave wav = new AsrtApiModel.Wave();
Wave wav = new Wave();
wav.deserialize(wavBytes);
byte[] sampleBytes = wav.getRawSamples();
int sampleRate = wav.sampleRate;
Expand All @@ -41,9 +44,9 @@ public static void main(String[] args) {
System.out.println(rsp.result);

// ============================================
// 调用ASRT声学模型识别语音序列
// 璋冪敤ASRT澹板妯″瀷璇嗗埆璇煶搴忓垪
wavBytes = Common.readBinFile(filename);
wav = new AsrtApiModel.Wave();
wav = new Wave();
wav.deserialize(wavBytes);
sampleBytes = wav.getRawSamples();
sampleRate = wav.sampleRate;
Expand All @@ -55,15 +58,15 @@ public static void main(String[] args) {
System.out.println(rsp.result);

// ============================================
// 调用ASRT语言模型识别拼音序列1
// 璋冪敤ASRT璇█妯″瀷璇嗗埆鎷奸煶搴忓垪1
String[] pinyins = ((String)rsp.result).split(", ");
rsp = sr.RecogniteLanguage(pinyins);
System.out.println(rsp.statusCode);
System.out.println(rsp.statusMessage);
System.out.println(rsp.result);

// ============================================
// 调用ASRT语言模型识别拼音序列2
// 璋冪敤ASRT璇█妯″瀷璇嗗埆鎷奸煶搴忓垪2
pinyins = new String[]{"ni3", "hao3", "a1"};
rsp = sr.RecogniteLanguage(pinyins);
System.out.println(rsp.statusCode);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package common;
package net.ailemon.asrt.sdk.common;

import java.io.UnsupportedEncodingException;
import java.util.Base64;
Expand Down
Loading

0 comments on commit 021f437

Please sign in to comment.