reference:
https://www.youtube.com/watch?v=uNfdq0GqstA

one can only assume what the actual code looks like, but here is mine:

Code:

package AXJava;

import java.util.Hashtable;

public class AXLSpeechModifier extends AXLHousing{
    public Hashtable<String,String> dic;

    public AXLSpeechModifier(Hashtable<String, String> dic) {
        this.dic = dic;
    }

    @Override
    public String decorate(String str1) {
        String result = "";
        String[] words = str1.split("\\s+");
        for (int i = 0; i < words.length; i++) {
            words[i] = dic.getOrDefault(words[i], words[i]);
            result = result + " " + words[i];
        }
        return result;
    }
}


pirate speech implementation:


Code:

package AXJava;

import java.util.Hashtable;

public class AXLPirate extends AXLHub{
    // example implementation of speech modification
    private AXLSpeechModifier c1 ;

    public AXLPirate() {
        Hashtable<String,String> dic = new Hashtable<>();
        dic.put("stop","avast");
        dic.put("hello","ahoy");
        dic.put("friend","matey");
        dic.put("yes","aye");
        dic.put("wow","shiver me timbers");
        dic.put("treasure","booty");
        dic.put("pirate","buccaneer");
        dic.put("younster","lad");
        dic.put("feed the fish","about to die");
        dic.put("pal","bucko");
        dic.put("great","yo ho ho");
        dic.put("awesome","yo ho ho");
        dic.put("woman","wench");
        dic.put("women","wenches");
        dic.put("disgusting","scurvy");
        dic.put("newbie","scallywag");
        dic.put("understood","aye aye");
        dic.put("attention","avast ye");
        dic.put("you","ye");
        c1 = new AXLSpeechModifier(dic);
    }

    @Override
    public String decorate(String str1) {
        return "arr" + c1.decorate(str1);
    }
}

use example:
AXLPirate p1 = new AXLPirate();
System.out.println(p1.decorate("hello there friend how are you"));

output:
arr ahoy there matey how are ye  rambo