Skip to content
The Chat Archive
gpt-3.5-turbo-0301· OpenAI WildChat-4.8M (AI2)

code to demonstrate pos(part of speech) using spicy

  1. User

    code to demonstrate pos(part of speech) using spicy

  2. Assistant

    import spacy

    nlp = spacy.load("en_core_web_sm")

    sentence = "The cat sat on the mat."

    doc = nlp(sentence)

    for token in doc: print(token.text, token.pos_)

    Output:

    The DET

    cat NOUN

    sat VERB

    on ADP

    the DET

    mat NOUN

  3. User

    hello

  4. Assistant

    Hello! How can I assist you today?