我正在从Wikipedia提取数据,并将它们提供给MaryTTS,这是语音库的文本。

因此,例如,我像这样从Wikipedia API获取文本:Wikipedia API Summary Searching for Donald Trump

产生问题的Java代码:



This line -> AudioInputStream audio = marytts.generateAudio(text);where MaryTTS is:MaryInterface marytts = new LocalMaryInterface();



引起错误的文字

Donald John Trump (born June 14, 1946) is the 45th and current President of the
United States. Before entering politics, he was a businessman and television per
sonality.\nTrump was born and raised in Queens, New York City, and earned an eco
nomics degree from the Wharton School. He then took charge of The Trump Organiza
tion, the real estate and construction firm founded by his paternal grandmother,
 which he ran for 45 years until 2016. During his real estate career, Trump buil
t, renovated, and managed numerous office towers, hotels, casinos, and golf cour
ses. Besides real estate, he started several side ventures and has licensed the
use of his name for the branding of various products and properties, including T
rump Entertainment Resorts. He was the founder of Trump University. He produced
and hosted The Apprentice, a reality television series on NBC, from 2004 to 2015
. His net worth was estimated to be $3.5 billion as of 2017, making him the 544t
h richest person in the world.\nTrump first publicly expressed interest in runni
ng for political office in 1987. He won two Reform Party presidential primaries
in 2000, but withdrew his candidacy early on. In June 2015, he launched his camp
aign for the 2016 presidential election and quickly emerged as the front-runner
among seventeen candidates in the Republican primaries. His remaining opponents
all suspended their campaigns by the end of May 2016, and in July he was formall
y nominated at the Republican National Convention along with Indiana governor Mi
ke Pence as his running mate. Many of his campaign statements were controversial
 or false, generating much free media coverage.\nTrump won the general election
on November 8, 2016, in a surprise victory against Democratic opponent Hillary C
linton and commenced his presidency on January 20, 2017. He became the oldest an
d wealthiest person ever to assume the presidency, the first without prior milit
ary or government service, and the fifth to have won the election while losing t
he popular vote. His political positions have been described by scholars and com
mentators as populist, protectionist, and nationalist."}}}}




错误:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/bas
e/Joiner
    at marytts.language.en.Preprocess.expandConsonants(Preprocess.java:497)
    at marytts.language.en.Preprocess.expand(Preprocess.java:382)
    at marytts.language.en.Preprocess.process(Preprocess.java:186)
    at marytts.server.Request.processOneChunk(Request.java:566)
    at marytts.server.Request.processOrLookupOneChunk(Request.java:403)
    at marytts.server.Request.process(Request.java:337)
    at marytts.LocalMaryInterface.process(LocalMaryInterface.java:438)
    at marytts.LocalMaryInterface.generateAudio(LocalMaryInterface.java:348)
    at application.TextToSpeech.speak(TextToSpeech.java:63)
    at application.WikipediaTalker.main(WikipediaTalker.java:52)
Caused by: java.lang.ClassNotFoundException: com.google.common.base.Joiner
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 10 more

最佳答案

从MaryTTS团队的角度来看这是非常非常奇怪的,他们似乎忽略了此错误的发生,通过在项目类路径上添加Guava 22.0解决了这一问题。

我也看不到要提及的依赖性:(。

关于java - MaryTTS异常NoClassDefFoundError:com/google/common/bas e/Joiner,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44479883/

10-12 00:32