I am getting an error message 'No constructor with matching signature found.' when construct a Java object that has been added to javaclasspath

7 次查看(过去 30 天)
I have made a Java class like the following:
import java.util.List;
import gov.nih.nlm.nls.metamap.AcronymsAbbrevs;
import gov.nih.nlm.nls.metamap.ConceptPair;
import gov.nih.nlm.nls.metamap.Ev;
import gov.nih.nlm.nls.metamap.Mapping;
import gov.nih.nlm.nls.metamap.MetaMapApi;
import gov.nih.nlm.nls.metamap.MetaMapApiImpl;
import gov.nih.nlm.nls.metamap.Negation;
import gov.nih.nlm.nls.metamap.PCM;
import gov.nih.nlm.nls.metamap.Position;
import gov.nih.nlm.nls.metamap.Result;
import gov.nih.nlm.nls.metamap.Utterance;
public class MetaMapTest{
public MetaMapTest() {
System.out.println("Nothing");
}
public MetaMapTest(String text) throws Exception{
String input = text;
MetaMapApi api = new MetaMapApiImpl();
System.out.println("api instanciated");
List<Result> resultList = api.processCitationsFromString(input);
Result result = resultList.get(0);
String machineOutput = result.getMachineOutput();
List<Negation> negList = result.getNegations();
if (negList.size() > 0) {
System.out.println("Negations:");
for (Negation e: negList) {
System.out.println("type: " + e.getType());
System.out.print("Trigger: " + e.getTrigger() + ": [");
for (Position pos: e.getTriggerPositionList()) {
System.out.print(pos + ",");
}
System.out.println("]");
System.out.print("ConceptPairs: [");
for (ConceptPair pair: e.getConceptPairList()) {
System.out.print(pair + ",");
}
System.out.println("]");
System.out.print("ConceptPositionList: [");
for (Position pos: e.getConceptPositionList()) {
System.out.print(pos + ",");
}
System.out.println("]");
}
} else {
System.out.println(" None.");
}
List<AcronymsAbbrevs> aaList = result.getAcronymsAbbrevs();
if (aaList.size() > 0) {
System.out.println("Acronyms and Abbreviations:");
for (AcronymsAbbrevs e: aaList) {
System.out.println("Acronym: " + e.getAcronym());
System.out.println("Expansion: " + e.getExpansion());
System.out.println("Count list: " + e.getCountList());
System.out.println("CUI list: " + e.getCUIList());
}
} else {
System.out.println(" None.");
}
for(Utterance utterance : result .getUtteranceList()) {
System.out.println("Utterance:");
System.out.println(" Id: "+ utterance.getId());
System.out.println(" Utterance text: "+ utterance.getString());
System.out.println(" Position: "+ utterance.getPosition());
for(PCM pcm : utterance .getPCMList()) {
System.out.println("Mappings:");
for(Mapping map : pcm .getMappingList()) {
System.out.println("Phrase:");
System.out.println(" Map Score: "+ map.getScore());
for(Ev mapEv : map .getEvList()) {
System.out.println(" Score: "+ mapEv.getScore());
System.out.println(" Concept Id: "+ mapEv.getConceptId());
System.out.println(" Concept Name: "+ mapEv.getConceptName());
System.out.println(" Preferred Name: "+ mapEv.getPreferredName());
System.out.println(" Matched Words: "+ mapEv.getMatchedWords());
System.out.println(" Semantic Types: "+ mapEv.getSemanticTypes());
System.out.println(" MatchMap: "+ mapEv.getMatchMap());
System.out.println(" MatchMap alt. repr.: "+ mapEv.getMatchMapList());
System.out.println(" is Head?: "+ mapEv.isHead());
System.out.println(" is Overmatch?: "+ mapEv.isOvermatch());
System.out.println(" Sources: "+ mapEv.getSources());
System.out.println(" Positional Info: "+ mapEv.getPositionalInfo());
}
}
System.out.println("Candidates:");
for (Ev ev: pcm.getCandidateList()) {
System.out.println(" Candidate:");
System.out.println(" Score: " + ev.getScore());
System.out.println(" Concept Id: " + ev.getConceptId());
System.out.println(" Concept Name: " + ev.getConceptName());
System.out.println(" Preferred Name: " + ev.getPreferredName());
System.out.println(" Matched Words: " + ev.getMatchedWords());
System.out.println(" Semantic Types: " + ev.getSemanticTypes());
System.out.println(" MatchMap: " + ev.getMatchMap());
System.out.println(" MatchMap alt. repr.: " + ev.getMatchMapList());
System.out.println(" is Head?: " + ev.isHead());
System.out.println(" is Overmatch?: " + ev.isOvermatch());
System.out.println(" Sources: " + ev.getSources());
System.out.println(" Positional Info: " + ev.getPositionalInfo());
}
}
}
}
}
And then I tried to call this function in Matlab like this:
o=MetaMapTest;
But I always get the message: 'No constructor 'MetaMapTest' with matching signature found.'
I thought I had already made the constructor, I don't understand why this is happening.
Thank you

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Call Java from MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by