• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python normalize.normalize函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中normalize.normalize函数的典型用法代码示例。如果您正苦于以下问题:Python normalize函数的具体用法?Python normalize怎么用?Python normalize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了normalize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: index

def index(**kwargs):
    if request.args.get('submit') is not None:
        active = request.form.get('tabStatus')
        params = ['siteDest', 'siteSource']
        if active == 'page':
            params.append('title')
        return redirect(url_for('.index', **get_params(params)), code=c.REQUEST)

    normalize(['title'], kwargs)
    if not request.form.get('tabStatus', False):
        if kwargs.get('siteDest', False) and not kwargs.get('title', False):
            kwargs['tabStatus'] = 'content'
        else:
            kwargs['tabStatus'] = 'page'

    if not request.form.get('siteDest', False) and not request.form.get('siteSource', False):
        kwargs['siteDest'] = 'th'
        kwargs['siteSource'] = 'en'

    form = wikitranslator.form.getForm()(request.form, **kwargs)
    data = wikitranslator.model.Model(form=form)
    if form.validate(data):
        data.render()
    return render('index.html',
                  tool=__name__,
                  form=form,
                  data=data)
开发者ID:nullzero,项目名称:wpcgi,代码行数:27,代码来源:wikitranslator.py


示例2: main

def main():
    timer = timers.Timer()
    with timers.timing("Parsing", True):
        task = pddl_parser.open(
            domain_filename=options.domain, task_filename=options.task)

    with timers.timing("Normalizing task"):
        normalize.normalize(task)

    if options.generate_relaxed_task:
        # Remove delete effects.
        for action in task.actions:
            for index, effect in reversed(list(enumerate(action.effects))):
                if effect.literal.negated:
                    del action.effects[index]

    sas_task = pddl_to_sas(task)
    dump_statistics(sas_task)

    with timers.timing("Writing output"):
        with open("output.sas", "w") as output_file:
            sas_task.output(output_file)
    print("Done! %s" % timer)
    global t1, t2
    t2 = time.time() - t2
    print('Time1:', t1)
    print('Time2:', t2)
开发者ID:danfis,项目名称:fast-downward-masters-thesis,代码行数:27,代码来源:translate.py


示例3: main

def main():
    options, args = parse_options()

    check_python_version(options.force_old_python)

    timer = timers.Timer()
    with timers.timing("Parsing", True):
        task = pddl.open()

    with timers.timing("Normalizing task"):
        normalize.normalize(task)

    if options.generate_relaxed_task:
        # Remove delete effects.
        for action in task.actions:
            for index, effect in reversed(list(enumerate(action.effects))):
                if effect.literal.negated:
                    del action.effects[index]

    sas_task = pddl_to_sas(task)
    dump_statistics(sas_task)

    with timers.timing("Writing output"):
        with open("output.sas", "w") as output_file:
            sas_task.output(output_file)
    print("Done! %s" % timer)
开发者ID:jinnaiyuu,项目名称:fast-downward,代码行数:26,代码来源:translate.py


示例4: main

def main():
    timer = timers.Timer()
    
    
    with timers.timing("Parsing", True):
        task = pddl_parser.open(task_filename=options.task, domain_filename=options.domain)
    with timers.timing("Normalizing task"):
        normalize.normalize(task)

    if options.generate_relaxed_task:
        # Remove delete effects.
        for action in task.actions:
            for index, effect in reversed(list(enumerate(action.effects))):
                if effect.literal.negated:
                    del action.effects[index]

    sas_task = pddl_to_sas(task)
    dump_statistics(sas_task)

    # Print pddl if a transormation option is selected.
    if options.exp or options.evmdd:
        pddl_parser.print_pddl(options.domain, sas_task, task, [])
        print("done!")
        exit(0)

    with timers.timing("Writing output"):
        with open("output.sas", "w") as output_file:
            sas_task.output(output_file)
    print("Done! %s" % timer) 
开发者ID:robertmattmueller,项目名称:sdac-compiler,代码行数:29,代码来源:translate.py


示例5: main

def main():
    print("-------------POND Translator-----------")
    args = parse_args()

    timer = timers.Timer()
    with timers.timing("Parsing", True):
        task = pddl.open(task_filename=args.task, domain_filename=args.domain)
      
        print();
        print("Problem Filename = " + args.task);
        print("Domain Filename = " + args.domain);
        print();
        
    with timers.timing("Normalizing task"):
        normalize.normalize(task)

    if args.generate_relaxed_task:
        # Remove delete effects.
        for action in task.actions:
            for index, effect in reversed(list(enumerate(action.effects))):
                if effect.literal.negated:
                    del action.effects[index]

    sas_task = pddl_to_sas(task)
    dump_statistics(sas_task)

    if not sas_task is None:
        with timers.timing("Writing output"):
            with open("..\\webapps\\LunaPlanner\\translator_output\\output.sas", "w") as output_file:
                sas_task.output(output_file)
                
        print()
        print("SAS file saved at: " + output_file.name)
                
        print("Done! %s" % timer)
开发者ID:JackyCSer,项目名称:LunaPlanner,代码行数:35,代码来源:translate.py


示例6: build_titles

def build_titles(title):
    normalized_title = normalize(title).lower()
    titles = [ title, normalized_title ];
    if title.find(' & ') != -1:
        t = title.replace(" & ", " and ")
        titles.append(t)
        titles.append(normalize(t))
    t2 = []
    for t in titles:
        if t.lower().startswith('the '):
            t2.append(t[4:])
        elif t.lower().startswith('a '):
            t2.append(t[2:])
    titles += t2

    if re_amazon_title_paren.match(title):
        t2 = []
        for t in titles:
            m = re_amazon_title_paren.match(t)
            if m:
                t2.append(m.group(1))
                t2.append(normalize(m.group(1)))
        titles += t2

    return {
        'full_title':       title,
        'normalized_title': normalized_title,
        'titles':           titles,
        'short_title':      normalized_title[:25],
    }
开发者ID:RaceList,项目名称:openlibrary,代码行数:30,代码来源:merge_marc.py


示例7: marc_title

def marc_title(amazon_first_parts, marc_first_parts):
#            print 'title found: ', marc_first_parts[-1]
    if normalize(marc_first_parts[-1]) not in titles:
        return False
    if compare_parts(marc_first_parts[:-1], amazon_first_parts):
        if verbose:
            print("match with MARC end title")
        return True
    if normalize(amazon_first_parts[0]) in titles:
        if compare_parts(marc_first_parts[:-1], amazon_first_parts[1:]):
            if verbose:
                print("match, both with titles")
            return True
        if match_seq(marc_first_parts[:-1], amazon_first_parts[1:]):
            if verbose:
                print("partial match, both with titles")
            return True
    if match_seq(marc_first_parts[:-1], amazon_first_parts):
        if verbose:
            print("partial match with MARC end title")
        return True
    if match_seq(marc_first_parts, amazon_first_parts):
        if verbose:
            print("partial match with MARC end title")
    return False
开发者ID:hornc,项目名称:openlibrary-1,代码行数:25,代码来源:names.py


示例8: main

def main():
    args = parse_args()

    timer = timers.Timer()
    with timers.timing("Parsing", True):
        task = pddl.open(task_filename=args.task,
                         domain_filename=args.domain,
                         addl_filename=args.addl)

    with timers.timing("Normalizing task"):
        normalize.normalize(task)

    if args.generate_relaxed_task:
        # Remove delete effects.
        for action in task.actions:
            for index, effect in reversed(list(enumerate(action.effects))):
                if effect.literal.negated:
                    del action.effects[index]

    output_file = args.output_file
    use_proto = args.use_proto
    print('Use Proto:', use_proto)

    sas_task = pddl_to_sas(task, args.agent_id, args.agent_url)
    dump_statistics(sas_task)

    with timers.timing("Writing output"):
        with open(output_file, "w") as output_file:
            if use_proto:
                sas_task.output_proto(output_file)
            else:
                sas_task.output(output_file)
    print("Done! %s" % timer)
开发者ID:danfis,项目名称:maplan,代码行数:33,代码来源:translate.py


示例9: main

def main():
    args = parse_args()

    timer = timers.Timer()
    with timers.timing("Parsing", True):
        task = pddl.open(task_filename=args.task, domain_filename=args.domain)

    with timers.timing("Normalizing task"):
        normalize.normalize(task)

    if args.generate_relaxed_task:
        # Remove delete effects.
        for action in task.actions:
            for index, effect in reversed(list(enumerate(action.effects))):
                if effect.literal.negated:
                    del action.effects[index]

    sas_task = pddl_to_sas(task)
    dump_statistics(sas_task)

    if not sas_task is None:
        with timers.timing("Writing output"):
            with open("output.sas", "w") as output_file:
                sas_task.output(output_file)
        print("Done! %s" % timer)
开发者ID:JackyCSer,项目名称:MyNDPlanner,代码行数:25,代码来源:translate.py


示例10: compare_author_fields

def compare_author_fields(e1_authors, e2_authors):
    for i in e1_authors:
        for j in e2_authors:
            if normalize(i['db_name']) == normalize(j['db_name']):
                return True
            if normalize(i['name']).strip('.') == normalize(j['name']).strip('.'):
                return True
    return False
开发者ID:hornc,项目名称:openlibrary-1,代码行数:8,代码来源:merge_marc.py


示例11: translate

def translate(task):
  normalize.normalize(task)
  prog = PrologProgram()
  translate_facts(prog, task)
  for conditions, effect in normalize.build_exploration_rules(task):
    prog.add_rule(Rule(conditions, effect))
  prog.normalize()
  prog.split_rules()
  return prog
开发者ID:TathagataChakraborti,项目名称:resource-conflicts,代码行数:9,代码来源:pddl_to_prolog.py


示例12: normalize

    def normalize(self):
        """
        Performs normalization. At this level, we do those normalizations that
        needs both the pre & post syscall objects
        """
        import normalize

        for id in self:
            pre,post = self.getSyscallByID(id)

            normalize.normalize(pre, post)
开发者ID:N3mes1s,项目名称:wusstrace,代码行数:11,代码来源:syscall.py


示例13: flip_marc_name

def flip_marc_name(marc):
    m = re_marc_name.match(marc)
    if not m:
        return remove_trailing_dot(marc)
    first_parts = split_parts(m.group(2))
    if normalize(first_parts[-1]) not in titles:
        # example: Eccles, David Eccles Viscount
        return remove_trailing_dot(m.group(2)) + ' ' + m.group(1)
    if len(first_parts) > 2 and normalize(first_parts[-2]) == normalize(m.group(1)):
        return u' '.join(first_parts[0:-1])
    return u' '.join(first_parts[:-1] + [m.group(1)])
开发者ID:hornc,项目名称:openlibrary-1,代码行数:11,代码来源:names.py


示例14: __init__

  def __init__(self, item_id, quantity, *options):
    """Store the descriptors of an order item in this object.

    Arguments:
    item_id -- the restaurants's numerial ID for the item
    quantity -- the quantity
    options -- any number of options to apply to the item

    """
    self.item_id = normalize(item_id, 'number')
    self.quantity = normalize(quantity, 'number')
    self.options = [normalize(option, 'number') for option in options]
开发者ID:ryankanno,项目名称:ecommercehackday,代码行数:12,代码来源:data.py


示例15: get_delivery_check

  def get_delivery_check(self, restaurant_id, date_time, address):
    """Get data about a given restaurant, including whether it will deliver to
    the specified address at the specified time

    Arguments:
    restaurant_id -- Ordr.in's restaurant identifier
    date_time -- Either 'ASAP' or a datetime object in the future
    address -- the address to deliver to. Should be an ordrin.data.Address object

    """
    dt = normalize(date_time, 'datetime')
    restaurant_id = normalize(restaurant_id, 'number')
    return self._call_api('GET', ('dc', restaurant_id, dt, address.zip, address.city, address.addr))
开发者ID:ryankanno,项目名称:ecommercehackday,代码行数:13,代码来源:restaurant.py


示例16: index

def index(**kwargs):
    if request.args.get("submit") is not None:
        return redirect(url_for(".index", **get_params(["title", "oldid"])), code=c.REQUEST)

    normalize(["title"], kwargs)
    form = dykchecker.form.getForm()(request.form, **kwargs)
    data = dykchecker.model.Model(form=form)
    if form.validate(data):
        data.render()
        return render("page.html", tool=__name__, form=form, data=data)

    else:
        return render("index.html", tool=__name__, form=form)
开发者ID:nullzero,项目名称:wpcgi,代码行数:13,代码来源:dykchecker.py


示例17: translate

def translate(task):
    with timers.timing("Normalizing task"):
        normalize.normalize(task)
    with timers.timing("Generating Datalog program"):
        prog = PrologProgram()
        translate_facts(prog, task)
        for conditions, effect in normalize.build_exploration_rules(task):
            prog.add_rule(Rule(conditions, effect))
    with timers.timing("Normalizing Datalog program", block=True):
        # Using block=True because normalization can output some messages
        # in rare cases.
        prog.normalize()
        prog.split_rules()
    return prog
开发者ID:Doddzy,项目名称:DAS-Fast-Downward,代码行数:14,代码来源:pddl_to_prolog.py


示例18: update

  def update(self, login, first_name, last_name):
    """Updates account for the user associated with login. Throws a relevant exception
    on failure.

    Arguments:
    login -- the user's login information. Should be an ordrin.data.UserLogin object
    first_name -- the user's first name
    last_name -- the user's last name
    
    """
    data = {'email':login.email,
            'first_name':normalize(first_name, 'name'),
            'last_name':normalize(last_name, 'name'),
            'pw':login.password}
    return self._call_api('POST', ('u', login.email), login=login, data=data)
开发者ID:ryankanno,项目名称:ecommercehackday,代码行数:15,代码来源:user.py


示例19: _call_api

 def _call_api(self, method, arguments, login=None, data=None):
   """Calls the api at the saved url and returns the return value as Python data structures.
   Rethrows any api error as a Python exception"""
   method = normalize(method, 'method')
   uri = '/'+('/'.join(urllib.quote_plus(str(arg)) for arg in arguments))
   full_url = self.base_url+uri
   headers = {}
   if self.key:
     headers['X-NAAMA-CLIENT-AUTHENTICATION'] = 'id="{}", version="1"'.format(self.key)
   if login:
     hash_code = sha256(''.join((login.password, login.email, uri))).hexdigest()
     headers['X-NAAMA-AUTHENTICATION'] = 'username="{}", response="{}", version="1"'.format(login.email, hash_code)
   try:
     r = self._methods[method](full_url, data=data, headers=headers)
   except KeyError:
     raise error.request_method(method)
   r.raise_for_status()
   try:
     result = json.loads(r.text)
   except ValueError:
     raise ApiInvalidResponseError(r.text)
   if '_error' in result and result['_error']:
     if 'text' in result:
       raise errors.ApiError((result['msg'], result['text']))
     else:
       raise errors.ApiError(result['msg'])
   return result
开发者ID:ryankanno,项目名称:ecommercehackday,代码行数:27,代码来源:ordrinapi.py


示例20: run

def run(parser, args):
##    
    ## TODO - just change to 1 argument: --protocol -- with options [1,2,3,4]
    if args.protocol1:
        protocol=1
    elif args.protocol2:
        protocol=2
    elif args.protocol3:
        protocol=3
    elif args.protocol4:
        protocol=4
    elif args.protocol5:
        protocol=5
    elif args.protocol6:
        protocol=6
    
    late = normalize(latestage=args.latestage, protocol=protocol, earlystage=args.earlystage, pseudo=args.pseudo, bandwidth=args.bandwidth, quiet=args.quiet)

    if args.regions:
        # find maximums (summits) within regions given
        regions = BedTool(args.regions)
        
    else:
        # find peak regions by algorithm at top, then summits within them
        ## Read in states bedGraph, identify peaks
##        states = CovBed(args.states)
        regions = find_candidate_regions(args.states, thresh_state=1, merge1=10e3, minwidth=50e3, merge2=40e3, max_state_thresh=2, internal=0.8)

    ##Covert CovBed object to BedTool object
    a = BedTool( StringIO.StringIO( late.get_bdg(bdg=late.count, collapsed=True) ) )
    ans = summits(a = a, b = regions)
    print str(ans).strip()
开发者ID:JohnUrban,项目名称:sciara-project-tools,代码行数:32,代码来源:findsummits.py



注:本文中的normalize.normalize函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python normalize.FieldSelector类代码示例发布时间:2022-05-27
下一篇:
Python normality.slugify函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap