×

Loading...
Ad by
  • 技多不压身,工到自然成:安省技工证书特训班,点击咨询报名!
Ad by
  • 技多不压身,工到自然成:安省技工证书特训班,点击咨询报名!

Anyone knows the detail of the following function? I guess it is probably a pattern recognition algorithm. but I have no idea other than that. Anyone knows?

def best_match(text):
     def func(fragment, page):
         fdata = page.fragment_data(fragment).strip()
         if text in fdata:
             return float(len(text)) / len(fdata) - (1e-6 * fragment.start)
         else:
             return 0.0
     return func
Report

Replies, comments and Discussions:

  • 工作学习 / 学科技术讨论 / I am learning Django. Anyone interested? we can learn together.
    • too late...alot of ppl already been there and done that. and got burnt
      • why is too late? hard to learn?
        • good framework, good language, very nice for startup or small-shop, but limited performance and scalability, DB drivers is sub-par.
          • clarification : scalability actually need other frameworks(python or not), Django itself does not have any tools built-in
            • Do you use this framework a lot?
              • helped couple friends. not my primary platform.
                • What platform you use ?
                  • java
          • Thanks for a nice summary. So it is a good frame work then?
            • very good framework indeed.
              • I want to push an event(message) to browsers in Django. Do you have any suggestion which package is good for this purpose?
                • web socket. full example at link:
                  • Thanks.
    • I was working on CBV in Django and found it sucks. Class is good for what it is good for. however it is not always good as explained in this video. Hope it would help other programmers as well.
      • never considered python as a nice OOP language to begin with. also. simple CBV is good with a flat/simple view.
        but as complexity grows. since the abstraction hides deeper down... developers are just digging a bigger hole...
    • Anyone knows the detail of the following function? I guess it is probably a pattern recognition algorithm. but I have no idea other than that. Anyone knows?
      def best_match(text):
           def func(fragment, page):
               fdata = page.fragment_data(fragment).strip()
               if text in fdata:
                   return float(len(text)) / len(fdata) - (1e-6 * fragment.start)
               else:
                   return 0.0
           return func
    • I am reading a paper "Extracting Web Data Using Instance-Based Learning" written by Professor Bing Liu. I am also experimenting the techniques used in the paper to extract contents from a webpage. Anyone interested on this topic?