package linguistics

import "testing"

func TestPOSTagger_Tag_Basic(t *testing.T) {
	pos := NewPOSTagger()
	tokens := []Token{
		{Text: "the"},    // DET
		{Text: "great"},  // ADJ (in common adjectives)
		{Text: "fox"},    // default NOUN
		{Text: "jumps"},  // VERB by suffix
		{Text: "quickly"},// ADV by -ly
		{Text: "over"},   // PREP
		{Text: "him"},    // PRON
	}
	tags, err := pos.Tag(tokens)
	if err != nil {
		t.Fatalf("Tag returned error: %v", err)
	}
	expected := []string{"DET", "ADJ", "NOUN", "VERB", "ADV", "PREP", "PRON"}
	if len(tags) != len(expected) {
		t.Fatalf("expected %d tags, got %d: %#v", len(expected), len(tags), tags)
	}
	for i := range expected {
		if tags[i] != expected[i] {
			t.Errorf("tag %d: expected %s, got %s", i, expected[i], tags[i])
		}
	}
}
