This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BoyerMoore | |
attr_accessor :text | |
attr_reader :pattern, :matches | |
def initialize( opts ) | |
@text = opts[:text] | |
end | |
def search( pattern_str ) | |
@pattern = Pattern.new( pattern_str ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
// http://acm.timus.ru/problem.aspx?space=1&num=1727 | |
static class Timus | |
{ | |
static void Main() | |
{ | |
var n = int.Parse(Console.ReadLine()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0177 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test python. | |
fro deata clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding=utf-8 -*- | |
import feedparser | |
import re | |
import collections | |
import math | |
def info_entropy(words): | |
result = 0 | |
total = sum([val for _, val in words.iteritems()]) | |
for word, cnt in words.iteritems(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
#!/usr/bin/env python | |
#-*- coding:utf -8-*- | |
''' | |
#Author: Staticor | |
#Company: EverString | |
#File: | |
#Description: this program | |
#Revision: //2013 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ "keys": ["alt+m"], "command": "markdown_preview", "args": {"target": "browser"} }, | |
{ "keys": ["enter"], | |
"command": "move", | |
"args": {"by": "characters", "forward": true}, | |
"context": | |
[ | |
{ "key": "following_text", "operator": "regex_contains", "operand": "^[)\\]\\>\\'\\\"]", "match_all": true }, | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# Calculate the countdown for the special day. | |
require 'Date' | |
days = (DateTime.new(2013,10,20) - DateTime.now).ceil | |
puts "Maybe #{days} days left." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testDemo() { | |
JiebaSegmenter segmenter = new JiebaSegmenter(); | |
String[] sentences = | |
new String[] {"这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。", "我不喜欢日本和服。", "雷猴回归人间。", | |
"工信处女干事每月经过下属科室都要亲口交代24口交换机等技术性器件的安装工作", "结果婚的和尚未结过婚的"}; | |
for (String sentence : sentences) { | |
System.out.println(segmenter.process(sentence, SegMode.INDEX).toString()); | |
} | |
} |
OlderNewer