<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Can u help me in this one? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/can-u-help-me-in-this-one/m-p/337019#M26420</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Please explain what you are going to do with this in ArcMap.&amp;nbsp; You have gotten help before and yet you keep asking for more on the same topic.&amp;nbsp; What are all these requests accomplishing?&amp;nbsp; Why you are so desperate to do these things?&amp;nbsp; Are these functions being developed for class assignments?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I cannot fit these functions to any obvious discipline that uses ArcMap.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Mar 2014 04:17:00 GMT</pubDate>
    <dc:creator>RichardFairhurst</dc:creator>
    <dc:date>2014-03-10T04:17:00Z</dc:date>
    <item>
      <title>Can u help me in this one?</title>
      <link>https://community.esri.com/t5/python-questions/can-u-help-me-in-this-one/m-p/337018#M26419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Please can u help me in the third function because I am desperate to know how should I do it&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;def split_on_separators(original, separators):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;""" (str, str) -&amp;gt; list of str&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Return a list of non-empty, non-blank strings from the original string&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;determined by splitting the string on any of the separators.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;separators is a string of single-character separators.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; split_on_separators("Hooray! Finally, we're done.", "!,")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;['Hooray', ' Finally', " we're done."]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"""&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;result = []&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;newstring = ''&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for index,char in enumerate(original):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if char in separators or index==len(original) -1:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;result.append(newstring)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;newstring=''&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if '' in result:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;result.remove('')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;newstring+=char&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return result&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;def average_sentence_length(text):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;""" (list of str) -&amp;gt; float&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Precondition: text contains at least one sentence. A sentence is defined&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;as a non-empty string of non-terminating punctuation surrounded by &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;terminating punctuation or beginning or end of file. Terminating &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;punctuation is defined as !?.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Return the average number of words per sentence in text. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; text = ['The time has come, the Walrus said\n',&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'To talk of many things: of shoes - and ships - and sealing wax,\n',&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Of cabbages; and kings.\n'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'And why the sea is boiling hot;\n'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'and whether pigs have wings.\n']&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; average_sentence_length(text)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;17.5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"""&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;words=0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import re&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for line in text:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;line_values = list(filter(("-").__ne__, line.strip().split()))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;words += len(line_values)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sentence =[x for x in re.compile('[.!?]').split(''.join(text).strip()) if x] &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ASL=words/len(sentence)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return ASL&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;def avg_sentence_complexity(text):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;""" (list of str) -&amp;gt; float&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Return the average number of phrases per sentence.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A sentence is defined as a non-empty string of non-terminating&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;punctuation surrounded by terminating punctuation&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;or beginning or end of file. Terminating punctuation is defined as !?.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Phrases are substrings of sentences, separated by one or more of the&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;following delimiters ,;: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; text = ['The time has come, the Walrus said\n',&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'To talk of many things: of shoes - and ships - and sealing wax,\n',&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Of cabbages; and kings.\n',&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'And why the sea is boiling hot;\n',&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'and whether pigs have wings.\n']&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; avg_sentence_complexity(text)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3.5 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"""&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sentences=0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Phrases=0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sentence=split_on_separators(text,'?!.')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for sep in sentence:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sentences+=1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Phrase=split_on_separators(text, ',;:')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for n in Phrase:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Phrases+=1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;complex = float(Phrases) / float(Sentences)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return complex&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Mar 2014 01:09:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-u-help-me-in-this-one/m-p/337018#M26419</guid>
      <dc:creator>PeterPete</dc:creator>
      <dc:date>2014-03-10T01:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: Can u help me in this one?</title>
      <link>https://community.esri.com/t5/python-questions/can-u-help-me-in-this-one/m-p/337019#M26420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Please explain what you are going to do with this in ArcMap.&amp;nbsp; You have gotten help before and yet you keep asking for more on the same topic.&amp;nbsp; What are all these requests accomplishing?&amp;nbsp; Why you are so desperate to do these things?&amp;nbsp; Are these functions being developed for class assignments?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I cannot fit these functions to any obvious discipline that uses ArcMap.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Mar 2014 04:17:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-u-help-me-in-this-one/m-p/337019#M26420</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-03-10T04:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: Can u help me in this one?</title>
      <link>https://community.esri.com/t5/python-questions/can-u-help-me-in-this-one/m-p/337020#M26421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I second Richard on this. What does the comparison of linguistic signatures has to do with GIS?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the recent past I answered a post similar to yours, here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/103785-Hey-I-was-wondering-about-this-function-problem-for-a-while"&gt;http://forums.arcgis.com/threads/103785-Hey-I-was-wondering-about-this-function-problem-for-a-while&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Since all you posts are not related to GIS, you can probably better take your questions to a forum like stackoverflow?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Mar 2014 09:10:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-u-help-me-in-this-one/m-p/337020#M26421</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-03-10T09:10:23Z</dc:date>
    </item>
  </channel>
</rss>

