Did I find the right examples for you? yes no

# analyse_nominal_group.find_sn_pos

All Samples(47)  |  Call(47)  |  Derive(0)  |  Import(0)
```We will find the nominal group which is in a known position
We have to use adjective_pos to return the end position of nominal group

:param list sentence: the sentence (list of strings)
:param begin_pos:the position of the nominal group
:return: the nominal group (as a list of words)
```

```        def find_sn_pos(sentence, begin_pos):
"""
We will find the nominal group which is in a known position
We have to use adjective_pos to return the end position of nominal group

:param list sentence: the sentence (list of strings)
:param begin_pos:the position of the nominal group
:return: the nominal group (as a list of words)
"""

if begin_pos >= len(sentence):
return []

end_pos = 1

#If it is a pronoun
if sentence[begin_pos] in ResourcePool().pronouns:
return [sentence[begin_pos]]

#If there is a nominal group with determinant
if sentence[begin_pos] in ResourcePool().determinants:
end_pos += adjective_pos(sentence, begin_pos + 1)
return sentence[begin_pos: end_pos + begin_pos]

#If we have 'something'
for k in ResourcePool().composed_nouns:
if sentence[begin_pos].startswith(k):
if sentence[begin_pos] in ResourcePool().noun_not_composed:
return []
return [sentence[begin_pos]]

#If there is a number, it will be the same with determinant
if other_functions.number(sentence[begin_pos]) == 1:
end_pos += adjective_pos(sentence, begin_pos + 1)
return sentence[begin_pos: end_pos + begin_pos]

#If it is a proper name
counter = begin_pos
while counter < len(sentence) and other_functions.find_cap_lettre(sentence[counter]) == 1:
counter += 1

#Default case return [] => ok if counter=begin_pos
return sentence[begin_pos: counter]
```

```
#We have not duplicate the proposal, it depends on the presence of the nominal group after
if analyse_nominal_group.find_sn_pos(phrase, 1):
phrase = [phrase[0]] + proposal + phrase[1:]
else:
phrase = [phrase[0]] + phrase[1:]

object = analyse_nominal_group.find_sn_pos(phrase[1:], 0)
```
```
phrase = [phrase[0]] + analyse_nominal_group.find_plural(phrase[1:])
object = analyse_nominal_group.find_sn_pos(phrase[1:], 0)

#We process the 'or' like the 'and' and remove it
```
```
#It should not be followed by a noun or by an adverb
if not analyse_nominal_group.find_sn_pos(phrase, phrase.index(i) + 1):
#If there is a proposal after 'to'
if phrase[phrase.index(i) + 1] in ResourcePool().proposals:
```
```                position = phrase.index(w) - 1

gr = analyse_nominal_group.find_sn_pos(phrase, position)

#We have to find the nominal group just before
```

```
#We recover the first part of the subject
sbj = analyse_nominal_group.find_sn_pos(phrase, position)

#We loop until we don't have a nominal group
```
```
#Reperform the 'and' or 'or' processing
sbj = analyse_nominal_group.find_sn_pos(phrase[1:], position)

#We process the 'or' like the 'and' and remove it
```
```            if not sbj:
phrase = ['that'] + phrase
sbj = analyse_nominal_group.find_sn_pos(phrase, position)

else:
```

```
#If there is a nominal group
if analyse_nominal_group.find_sn_pos(sentence, 0):
return sentence

```
```        if sentence[i] == 'but':
#After 'but' of subsentence we must have a nominal group (subject)
scd_nominal_group = analyse_nominal_group.find_sn_pos(sentence, i + 1)
if not scd_nominal_group:
sentence[i] = ':but'
else:

#We have to find the first nominal group
begin_pos = i - 1
fst_nominal_group = analyse_nominal_group.find_sn_pos(sentence, begin_pos)
```
```                while fst_nominal_group == [] and begin_pos > 0:
begin_pos -= 1
fst_nominal_group = analyse_nominal_group.find_sn_pos(sentence, begin_pos)
#The case when but is between 2 adjectives and we have the same noun
if fst_nominal_group[len(fst_nominal_group) - 1] == 'but':
```
```    """

nominal_group = analyse_nominal_group.find_sn_pos(sentence, position)
list_nominal_group = nominal_group

```

```
#If there is which or no nominal group it is a question
if sentence[0] != 'which' and analyse_nominal_group.find_sn_pos(sentence, 1) != []:
#Here we have the condition of the subsentences
return [stc_start_subsentence(sentence)]
```
```    else:
#After the first gr if there is no nominal group
if not analyse_nominal_group.find_sn_pos(sentence, len(gr)):
for i in ResourcePool().sentence_starts:
#If just after we have an a auxiliary
if sentence[len(gr)] == i[0] and i[1] == '3':
#With subject => it is a yes or no question form
if analyse_nominal_group.find_sn_pos(sentence, len(gr) + 1):
```
```
#In this case we have an imperative sentence
elif analyse_nominal_group.find_sn_pos(sentence, 1) == [] and type != W_QUESTION:
#We have to reput the 'not'
if vg.state == Verbal_Group.negative:
```
```
#We search the subject
sbj = analyse_nominal_group.find_sn_pos(sentence, 0)

if sbj != [] or type == RELATIVE:
```