Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8587849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:40:08+00:00 2026-06-11T22:40:08+00:00

I am having difficulty getting help from the Mallet dev list, so I am

  • 0

I am having difficulty getting help from the Mallet dev list, so I am trying here.

I have an InstancesList with a target alphabet of {A, B, C} and I need to change the target alphabet for another analysis to {A, NOT_A}.

So far, I have the following code (adapted from other Mallet source code) but I
keep getting:

Alphabets don’t match: Instance: [5976, null], InstanceList: [5976, 2]

...
InstanceList iListCopy = (InstanceList) instances.clone();

Alphabet blank = new Alphabet();
Alphabet newAlpha = new Alphabet();

//A and NOT_A cannot be found in alphabet, so add them.
newAlpha.lookupIndex("A", true);
newAlpha.lookupIndex("NOT_A", true);

Noop pipe = new Noop(blank, newAlpha);
InstanceList newIList = new InstanceList(pipe);

//iterate through each instance and change the target based on the
original value.
for (int i = 0; i < iListCopy.size(); i++) {
   Instance inst = iListCopy.get(i);

   FeatureVector original = (FeatureVector) inst.getData();
   Instance newInst = pipe.instanceFrom(new Instance(original,
newAlpha, inst.getName(), inst.getSource()));
   if (inst.getLabeling().toString().equals("A") {  
       newInst.setTarget("A");
   } else {
       newInst.setTarget("NOT_A");
   }
   newIList.add(newInst);   //FAILS with "Alphabets do not match."
}
...

Does anyone have any suggestions on how I can change the target alphabet from {A, B, C} to {A, NOT_A}?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:40:09+00:00Added an answer on June 11, 2026 at 10:40 pm

    Target should be a Label. Try this:

    ..
    newInst.setTarget(((LabelAlphabet) newList.getTargetAlphabet()).lookupLabel("A"));
    ..
    newInst.setTarget(((LabelAlphabet) newList.getTargetAlphabet()).lookupLabel("NOT_A"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having great difficulty getting my Android application to play videos from the SD
I'm a newbie to c# and am having some difficulty getting an integer from
I'm having some difficulty getting my cross domain policy to work. I have an
I'm having difficulty getting my textarea to expand vertically automatically. I have some code
I'm having real difficulty getting the eclipselink.join-fetch hint to work in glassfish. I have
I am having difficulty getting rid if the following error: bash-3.00$ p4 login Enter
I am having difficulty getting multiple jPicker instances of the same type to display
I'm having difficulty getting XQuery to work. I downloaded Saxon-HE 9.2. It seems to
I'm having difficulty getting GNUplot to properly render some of my data. Basically I
I am having difficulty getting several mod_rewrite rules to work together in my .htaccess

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.