Inconsistent Annotation for the text using DBpedia Spotlight

Hey everyone !! I am annotating web pages using Spotlight and I found that some entities are not getting annotated properly. Say for a paragraph about Python programming language or web pages containing references of python language, python is getting annotated as pythonaide which in DBpedia is for Python snake.
Also, I encountered one more problem where when the text on Machine Learning written by some person X was annotated, Spotlight annotates the person’s name X but it referred to the wrong person X in its annotations. The person Spotlight referred to in its URI had nothing to do with Machine Learning.
If anyone can suggest any measures that should be taken while using Spotlight or some other programming measures to overcome such issues it would really be helpful.

Hi @ansh25lehri

Sorry for the delay in the answer. DBpedia-Spotlight is based on a confidence value from 0-1 to determine the quality of the annotations. A confidence value equal to 1 will annotate only the exact match. For example, the following annotation defines confidence as 0.35 which will select candidates which has at least the 0.35 of confidence value (that means, the result will be more annotations but the precision could not be the best).

curl \
 --data-urlencode "text=President Obama called Wednesday on Congress to extend a tax break for students included in last year's economic stimulus package, arguing that the policy provides more generous assistance." \
 --data "confidence=0.35" \
 -H "Accept: text/turtle"  

I hope this information help you. Have a great day.