title: Is there a function that allows me to determine if a text talks about a pre defined topic?
body: <p>I want to write topic lists to check whether a review talks about one of the defined topics. It's important for me to write the topic lists myself and not use topic modeling to find possible topics.</p>
  
  <p>I thought this is called dictionary analysis, but I can't find anything.</p>
  
  <p>I have a data frame with reviews from amazon:</p>
  
  <pre><code>df = pd.DataFrame({'User': ['UserA', 'UserB','UserC'], 
  'text': ['Example text where he talks about a phone and his charging cable',
   'Example text where he talks about a car with some wheels',
   'Example text where he talks about a plane']})
  </code></pre>
  
  <p>Now I want to define topic lists:</p>
  
  <pre><code>phone = ['phone', 'cable', 'charge', 'charging', 'call', 'telephone']
  car = ['car', 'wheel','steering', 'seat','roof','other car related words']
  plane = ['plane', 'wings', 'turbine', 'fly']
  </code></pre>
  
  <p>The result of the method should be 3/12 for the "phone" topic of the first review (3 words of the topic list where in the review which has 12 words) and 0 for the other two topics.</p>
  
  <p>The second review would result in 2/11 for the "car" topic and 0 for the other topics and for the third review 1/8 for the "plane" topic and 0 for the others.</p>
  
  <p>Results as a list:</p>
  
  <pre><code>phone_results = [0.25, 0, 0]
  car_results = [0, 0.18181818182, 0]
  plane_results = [0, 0, 0.125]
  </code></pre>
  
  <p>Of course I would only use lowercase wordstems of the reviews which makes defining topics easier, but this should not be of concern now.</p>
  
  <p>Is there a method for this or do I have to write one?
  Thank you in advance!</p>