vi21

joined 4 years ago
MODERATOR OF
 

I tried to port a LSTM example in Python and the Rust version is much faster than the original. I wonder whether this is normal. 🤦‍

 

เว็บ Mozilla.org นี่เหมาะสำหรับท่านที่ต้องการงานแปลที่ท้าทายครับ

ถ้าแปลตรง ๆ คำต่อคำจะไม่น่าอ่าน อ่านภาษาอังกฤษง่ายกว่า ก็เลยต้องใช้ความคิดสร้างสรรมาก

แต่ว่าก็ต้องรักษาความหมายเดิมไว้ด้วย และศัพท์เทคนิคก็ต้องคงเส้นคงวาด้วย

เรียนเชิญทุกท่านมาแปลดูครับครับ

 

The #Apertium channel has already moved from Freenode to OFTC

Apertium เป็น rule-based machine translation

 

ท่าน Yy เอา Supabase https://supabase.io/ มาให้ดูทาง Telegram แบบสั้นเลยก็คือมันเป็นสิ่งที่ใช้แทน Firebase แต่ว่าเป็น open source software ข้างในใช้ PostgreSQL เป็นหลักมี PostgREST ที่ท่าน @[email protected] เคยเล่าให้ฟัง อีกตัวที่น่าสนใจคือ Realtime ที่ใช้ Phoenix + Elixir ที่ท่าน @[email protected] เชียร์อยู่ มันจะส่งข้อความทาง websocket ที่ท่าน มาบอกเลยเวลา database มีการเปลี่ยนแปลง

ตอนนี้ก็เข้าไปใช้ได้เลยมีทั้ง service แบบฟรีแบบเสียตัง หรือจะโหลดมาติดตั้งเองก็แล้วแต่

 

เสียดาย Elixir รุ่นที่ใช้ไม่มี Enum.product

ไม่ได้ตรวจคำตอบไม่รู้ถูกเปล่า ?

ชี้แนะด้วยครับ

defmodule Euler8 do
  def run() do
    "73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
12540698747158523863050715693290963295227443043557
66896648950445244523161731856403098711121722383113
62229893423380308135336276614282806444486645238749
30358907296290491560440772390713810515859307960866
70172427121883998797908792274921901699720888093776
65727333001053367881220235421809751254540594752243
52584907711670556013604839586446706324415722155397
53697817977846174064955149290862569321978468622482
83972241375657056057490261407972968652414535100474
82166370484403199890008895243450658541227588666881
16427171479924442928230863465674813919123162824586
17866458359124566529476545682848912883142607690042
24219022671055626321111109370544217506941658960408
07198403850962455444362981230987879927244284909188
84580156166097919133875499200524063689912560717606
05886116467109405077541002256983155200055935729725
71636269561882670428252483600823257530420752963450"
    |> (&Regex.replace(~r/\n/, &1, "")).()
    |> (&Regex.scan(~r/\d{13}/, &1)).()
    |> Enum.map(&List.first(&1))
    |> Enum.map(fn chunk ->
      chunk
      |> String.codepoints
      |> Enum.map(&String.to_integer(&1))
      |> Enum.reduce(&(&1 * &2))
    end)
    |> Enum.max
  end  
end
 

Mark Watson ออกหนังสือ Practical Artificial Intelligent Programming With Clojure เล่มนี้ผมเคยอ่านแค่สารบัญ แต่จากที่อ่าน Common Lisp มา มันคือ practical มาก ๆ แบบลอก code ตามได้เลย 😅 ในเล่มนี้หลายอย่างพอของ Clojure หรือบน JVM ไม่มี library ที่ต้องการเขาก็ไปเรียกของ Python มาใช้เลย เล่มนี้ชื่อ AI แต่ก็ค่อนข้างเน้น #NLP ที่ดูผ่าน ๆ ก็ไม่ถึงกับ train model แต่ว่าเอาพวก spaCY และอื่น ๆ มาใช้ มี semantic web ด้วย

https://mastodon.social/@mark_watson/106274520174482155

 

black จัดให้แบบนี้

elif word[i : i + 2] == _DOUBLE_RO_RUA:

แต่ pep8speaks บอกว่า

Line 177:20: E203 whitespace before ':'

เอาแบบไหนดีครับ ?

1
submitted 3 years ago* (last edited 3 years ago) by [email protected] to c/[email protected]
 

พี่แบคบอกว่า black นั่นล่ะคือ linter ผมก็เลยลองรันดู

black -l 79 pythainlp

ปรากฎว่าไฟล์โดนแก้เพียบเลย

$ git status
On branch dev
Your branch is up to date with 'origin/dev'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   pythainlp/benchmarks/word_tokenization.py
        modified:   pythainlp/cli/data.py
        modified:   pythainlp/cli/soundex.py
        modified:   pythainlp/cli/tag.py
        modified:   pythainlp/cli/tokenize.py
        modified:   pythainlp/corpus/__init__.py
        modified:   pythainlp/corpus/core.py
        modified:   pythainlp/corpus/wordnet.py
        modified:   pythainlp/summarize/core.py
        modified:   pythainlp/summarize/freq.py
        modified:   pythainlp/summarize/mt5.py
        modified:   pythainlp/tag/_tag_perceptron.py
        modified:   pythainlp/tag/chunk.py
        modified:   pythainlp/tag/crfchunk.py
        modified:   pythainlp/tag/named_entity.py
        modified:   pythainlp/tag/pos_tag.py
        modified:   pythainlp/tokenize/core.py
        modified:   pythainlp/tokenize/nercut.py
        modified:   pythainlp/translate/__init__.py
        modified:   pythainlp/transliterate/__init__.py
        modified:   pythainlp/transliterate/thai2rom.py
        modified:   pythainlp/transliterate/thaig2p.py
        modified:   pythainlp/transliterate/w2p.py
        modified:   pythainlp/ulmfit/__init__.py
        modified:   pythainlp/ulmfit/preprocess.py
        modified:   pythainlp/util/keyboard.py
        modified:   pythainlp/util/strftime.py
        modified:   pythainlp/util/thai.py
        modified:   pythainlp/util/trie.py
        modified:   pythainlp/wangchanberta/core.py
        modified:   pythainlp/wangchanberta/postag.py

สงสัยต้องรันแบบระบุไฟล์เดียวไปเลย ?

 

ตอน pull request ผมเห็นมีช่องให้บอกว่าผ่าน linter แล้ว แบบนี้

[ ] Passed code linting checks and unit test

แต่ไม่รู้ว่า Python เขาใช้อะไรกัน แล้วแต่ละ project ใช้ตัวไหน

 

cross-posted from: https://lemmy.ml/post/64267

ไม่ได้ทำอะไรที่มีประโยชน์เท่าไหร่ แค่ลบ code ส่วนที่ไม่ได้ใช้ทิ้ง เรียกว่าฝึกหัดแล้วกัน

อีกอย่างผมรัน linter ไม่เป็น

 

ไม่ได้ทำอะไรที่มีประโยชน์เท่าไหร่ แค่ลบ code ส่วนที่ไม่ได้ใช้ทิ้ง เรียกว่าฝึกหัดแล้วกัน

อีกอย่างผมรัน linter ไม่เป็น

view more: ‹ prev next ›