import wikipedia
from emoji import emojize
from IPython.display import display, Markdown
from textblob import TextBlob

def analyze_sentiment(text):
    analysis = TextBlob(text)
    sentiment_score = analysis.sentiment.polarity
    
    if sentiment_score > 0:
        return emojize(":grinning_face: This article seems positive!")
    elif sentiment_score < 0:
        return emojize(":thumbs_down: This article seems negative.")
    else:
        return emojize(":neutral_face: This article seems neutral.")

def wiki_search_with_feedback():
    term = input("Enter a term to search on Wikipedia: ")
    
    try:
        result = wikipedia.search(term)
        summary = wikipedia.summary(result[0])  
        display(Markdown(f"### Wikipedia Summary for **{term}**"))
        display(Markdown(summary))
        sentiment_feedback = analyze_sentiment(summary)
        display(Markdown(f"**Sentiment Analysis Result:** {sentiment_feedback}"))

    except wikipedia.exceptions.DisambiguationError as e:
        display(Markdown(f":warning: **Multiple results found for '{term}', please be more specific:**"))
        for option in e.options[:5]:
            display(Markdown(f"- {option}"))
    except wikipedia.exceptions.PageError:
        display(Markdown(f":warning: **No page found for '{term}', please try a different search term.**"))

wiki_search_with_feedback()

Wikipedia Summary for apple

In mathematics and computer science, apply is a function that applies a function to arguments. It is central to programming languages derived from lambda calculus, such as LISP and Scheme, and also in functional languages. It has a role in the study of the denotational semantics of computer programs, because it is a continuous function on complete partial orders. Apply is also a continuous function in homotopy theory, and, indeed underpins the entire theory: it allows a homotopy deformation to be viewed as a continuous path in the space of functions. Likewise, valid mutations (refactorings) of computer programs can be seen as those that are “continuous” in the Scott topology. The most general setting for apply is in category theory, where it is right adjoint to currying in closed monoidal categories. A special case of this are the Cartesian closed categories, whose internal language is simply typed lambda calculus.

Sentiment Analysis Result: 😀 This article seems positive!