package linguistics

import "testing"

func TestLemmatizer_English(t *testing.T) {
	l := NewLemmatizer()
	cases := []struct{
		in, want string
	}{
		{"Went", "go"},
		{"running", "run"},
		{"studies", "study"},
		{"cars", "car"},
		{"looked", "look"},
	}
	for _, c := range cases {
		got, err := l.Lemma(c.in, "en")
		if err != nil {
			t.Fatalf("Lemma returned error: %v", err)
		}
		if got != c.want {
			t.Errorf("Lemma(%q) = %q; want %q", c.in, got, c.want)
		}
	}
}

func TestLemmatizer_Spanish(t *testing.T) {
	l := NewLemmatizer()
	got, err := l.Lemma("hablando", "es")
	if err != nil {
		t.Fatalf("Lemma returned error: %v", err)
	}
	if got != "habl" {
		t.Errorf("Lemma(hablando) = %q; want 'habl'", got)
	}
}

func TestLemmatizer_French(t *testing.T) {
	l := NewLemmatizer()
	got, err := l.Lemma("parlent", "fr")
	if err != nil {
		t.Fatalf("Lemma returned error: %v", err)
	}
	if got != "parl" {
		t.Errorf("Lemma(parlent) = %q; want 'parl'", got)
	}
}
