title: Detect sentence from a JSON file and extract related entities
body: <p>I have a dataset that represents one sentence of the parsed text and looks like this: </p>
  
  <pre><code>[{
      "address": 1,
      "ctag": "Ne",
      "feats": "_",
      "head": 6,
      "lemma": "Ashraf",
      "rel": "SBJ",
      "tag": "Ne",
      "word": "Ashraf"
  }, {
      "address": 2,
      "ctag": "AJ",
      "feats": "_",
      "head": 1,
      "lemma": "Ghani",
      "rel": "NPOSTMOD",
      "tag": "AJ",
      "word": "Ghani"
  }, {
      "address": 3,
      "ctag": "P",
      "feats": "_",
      "head": 6,
      "lemma": "in",
      "rel": "ADV",
      "tag": "P",
      "word": "in"
  }, {
      "address": 4,
      "ctag": "N",
      "feats": "_",
      "head": 3,
      "lemma": "Kabul",
      "rel": "POSDEP",
      "tag": "N",
      "word": "Kabul"
  }, {
      "address": 5,
      "ctag": "N",
      "feats": "_",
      "head": 6,
      "lemma": "born",
      "rel": "NVE",
      "tag": "N",
      "word": "born"
  }, {
      "address": 6,
      "ctag": "V",
      "feats": "_",
      "head": 0,
      "lemma": "شدشو",
      "rel": "ROOT",
      "tag": "V",
      "word": "شده_است"
  }, {
      "address": 7,
      "ctag": "PUNC",
      "feats": "_",
      "head": 6,
      "lemma": ".",
      "rel": "PUNC",
      "tag": "PUNC",
      "word": "."
  }]
  </code></pre>
  
  <p>In <code>"Adress": 7</code>, the <code>"ctag":"PUNC"</code> present end of the sentence. My original dataset contain several sentences. First, I want to detect that this is sentence one, from each sentence that ends with <code>PUNC</code> or <code>.</code>, I want to check first, in the first sentence to extract the special <code>two or three</code> entities like <code>'ctag'='Ne'</code> and for the next word, <code>'ctag'= 'N'</code>, then the relation between these two entities are <code>'rel'= 'NVE'</code> and then it should be stored in a list. </p>
  
  <p>What I did:</p>
  
  <pre><code># read file
  with open('../data/parse.txt', 'r') as myfile:
      obj = json.load(myfile)
  for w in obj:
      if w['ctag'] == 'Ne' and w['rel'] == 'SBJ':
          n1.append(w['word'])
      if w['ctag'] == 'N' and w['rel'] == 'SBJ':
          n6.append(w['word'])
      if w['ctag'] == 'N' and w['rel'] == 'MOZ':
          n2.append(w['word'])
      if w['rel'] == 'NVE' and w['ctag'] == 'N':
          n3.append(w['word'])
      if w['rel'] == 'MOZ' and w['ctag'] =='Ne':
          n4.append(w['word'])
      if w['rel'] =='MOS' and w['ctag'] == 'Ne':
          n5.append(w['word'])
      if w['rel'] == 'OBJ' and w['ctag'] == 'N':
         n7.append(w['word'])
  </code></pre>
  
  <p>It means that from <code>27</code> address I found this number of entities:</p>
  
  <pre><code>rel=SBJ &amp; Ne: ['Ashraf']
  rel=MOZ &amp; Ne ['President', 'Capital', 'Lecturer', 'University']
  rel=MOS &amp; Ne ['Ashraf', 'Kabul', 'Ahmad']
  rel=MOZ &amp; N ['Afghanistan', 'Afghanistan', 'Kabul']
  rel=NVE &amp; N ['born']
  rel=SBJ &amp; N ['Kabul']
  rel=OBJ &amp; N ['Located']
  </code></pre>
  
  <p>What I want:
  - It should find the first <code>"."</code> or <code>"PUNC"</code>, and then in this first sentence, check the entities, so I found that <code>if word['ctag'] =='Ne' and word['rel'] == 'MOZ':</code> then these are the relation entities, the rest are the named entities, like <code>subject &amp; object</code>. 
  - then it should go to the next <code>"PUNC"</code> and retrive <code>Ne</code> and <code>rel</code>.</p>
  
  <p>--> The output I expected from each sentence:
     <code>(e1, relation, e2)</code>--> <code>(Kabul, located, Afghanistan)</code></p>