Skip to main content

Home/ interesting_sites/ Group items matching "time" in title, tags, annotations or url

Group items matching
in title, tags, annotations or url

Sort By: Relevance | Date Filter: All | Bookmarks | Topics Simple Middle
mesbah095

Guest Post Online - 0 views

  •  
    Article Writing & Guestpost You Can Join this Site for Your Article & guest post, Just Easy way to join this site & total free Article site. This site article post to totally free Way. Guest Post & Article Post live to Life time only for Current & this time new User. http://guestpostonline.com
pagetribe .

http://nltk.googlecode.com/svn/trunk/doc/book/ch01.html - 0 views

  • We can count how often a word occurs in a tex
  • Adding two lists creates a new list
  • count the occurrences of a particular word using text1.count('heaven')
  • ...18 more annotations...
  • By convention, m:n means elements m…n-1
  • A consequence of this last change is that the list only has four elements, and accessing a later value generates an error
  • We can join the words of a list to make a single string, or split a string into a list, as follows:
  • 'Monty Python'.split()
  • frequency distribution
  • frequency of each vocabulary item
  • find the 50 most frequent words
  • hese very long words are often hapaxes (i.e. unique) and perhaps it would be better to find frequently occurring long words.
  • Here are all words from the chat corpus that are longer than 7 characters, that occur more than 7 times:   >>> fdist5 = FreqDist(text5) >>> sorted([w for w in set(text5) if len(w) > 7 and fdist5[w] > 7]) ['#14-19teens', '#talkcity_adults', '((((((((((', '........', 'Question', 'actually', 'anything', 'computer', 'cute.-ass', 'everyone', 'football', 'innocent', 'listening', 'remember', 'seriously', 'something', 'together', 'tomorrow', 'watching'] >>>
  • The collocations() function does this for us
  • find bigrams that occur more often than we would expect based on the frequency of individual words.
  • fdist = FreqDist(samples) create a frequency distribution containing the given samples fdist.inc(sample) increment the count for this sample fdist['monstrous'] count of the number of times a given sample occurred fdist.freq('monstrous') frequency of a given sample fdist.N() total number of samples fdist.keys() the samples sorted in order of decreasing frequency for sample in fdist: iterate over the samples, in order of decreasing frequency fdist.max() sample with the greatest count fdist.tabulate() tabulate the frequency distribution fdist.plot() graphical plot of the frequency distribution fdist.plot(cumulative=True) cumulative plot of the frequency distribution fdist1 < fdist2 test if samples in fdist1 occur less frequently than in fdist2
  • it goes through each word in text1, assigning each one in turn to the variable w and performing the specified operation on the variable.
  • The above notation is called a "list comprehension"
  • [f(w) for ...] or [w.f() for ...],
  • Now that we are not double-counting words like This and this
  • by filtering out any non-alphabetic items:   >>> len(set([word.lower() for word in text1 if word.isalpha()]))
  • A collocation is a sequence of words which occur together unusually often. Thus red wine is a collocation, while the wine is not. A characteristic of collocations is that they are resistant to substitution with words that have similar senses — maroon wine sounds definitely odd.
pagetribe .

Django Tagging - 0 views

shared by pagetribe . on 18 Nov 08 - Cached
  • >>> tags = Tag.objects.usage_for_model(Widget, counts=True)
  • [('cheese', 1), ('house', 2), ('thing', 1), ('toast', 1)]
  •  
    def usage_for_model(self, model, counts=False, min_count=None, filters=None): """ Obtain a list of tags associated with instances of the given Model class. If ``counts`` is True, a ``count`` attribute will be added to each tag, indicating how many times it has been used against the Model class in question. If ``min_count`` is given, only tags which have a ``count`` greater than or equal to ``min_count`` will be returned. Passing a value for ``min_count`` implies ``counts=True``. To limit the tags (and counts, if specified) returned to those used by a subset of the Model's instances, pass a dictionary of field lookups to be applied to the given Model as the ``filters`` argument. """ if filters is None: filters = {} if min_count is not None: counts = True model_table = qn(model._meta.db_table) model_pk = '%s.%s' % (model_table, qn(model._meta.pk.column)) query = """ SELECT DISTINCT %(tag)s.id, %(tag)s.name%(count_sql)s FROM %(tag)s INNER JOIN %(tagged_item)s ON %(tag)s.id = %(tagged_item)s.tag_id INNER JOIN %(model)s ON %(tagged_item)s.object_id = %(model_pk)s %%s WHERE %(tagged_item)s.content_type_id = %(content_type_id)s %%s GROUP BY %(tag)s.id, %(tag)s.name %%s ORDER BY %(tag)s.name ASC""" % { 'tag': qn(self.model._meta.db_table), 'count_sql': counts and (', COUNT(%s)' % model_pk) or '', 'tagged_item': qn(self._get_related_model_by_accessor('items')._meta.db_table), 'model': model_table, 'model_pk': model_pk, 'content_type_id': ContentType.objects.get_for_model(model).pk, } extra_joins = '' extra_criteria = '' min_count_sql
  •  
    usage_for_model
pagetribe .

Django | Sending e-mail | Django Documentation - 0 views

  • Testing e-mail sending¶ The are times when you do not want Django to send e-mails at all. For example, while developing a website, you probably don't want to send out thousands of e-mails -- but you may want to validate that e-mails will be sent to the right people under the right conditions, and that those e-mails will contain the correct content.
  •  
    python -m smtpd -n -c DebuggingServer localhost:1025
1 - 6 of 6
Showing 20 items per page