Markov: unicode debugging lines
This commit is contained in:
		
							parent
							
								
									acfcd574b5
								
							
						
					
					
						commit
						ad2044a178
					
				@ -63,7 +63,7 @@ def import_file(request):
 | 
				
			|||||||
def _learn_line(line, context):
 | 
					def _learn_line(line, context):
 | 
				
			||||||
    """Create a bunch of MarkovStates for a given line of text."""
 | 
					    """Create a bunch of MarkovStates for a given line of text."""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    log.debug("learning {0:.40s}...".format(line))
 | 
					    log.debug(u"learning {0:.40s}...".format(line))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    words = line.split()
 | 
					    words = line.split()
 | 
				
			||||||
    words = [MarkovState._start1, MarkovState._start2] + words + [MarkovState._stop]
 | 
					    words = [MarkovState._start1, MarkovState._start2] + words + [MarkovState._stop]
 | 
				
			||||||
@ -73,7 +73,7 @@ def _learn_line(line, context):
 | 
				
			|||||||
            return
 | 
					            return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for i, word in enumerate(words):
 | 
					    for i, word in enumerate(words):
 | 
				
			||||||
        log.debug("{0:s},{1:s} -> {2:s}".format(words[i], words[i+1], words[i+2]))
 | 
					        log.debug(u"'{0:s}','{1:s}' -> '{2:s}'".format(words[i], words[i+1], words[i+2]))
 | 
				
			||||||
        state, created = MarkovState.objects.get_or_create(context=context,
 | 
					        state, created = MarkovState.objects.get_or_create(context=context,
 | 
				
			||||||
                                                           k1=words[i],
 | 
					                                                           k1=words[i],
 | 
				
			||||||
                                                           k2=words[i+1],
 | 
					                                                           k2=words[i+1],
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user