Warning: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in ..../includes/class_bbcode.php on line 2958

Warning: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in ..../includes/class_bbcode.php on line 2958

Warning: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in ..../includes/class_bbcode.php on line 2958

Warning: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in ..../includes/class_bbcode.php on line 2958
نرم‌افزار پارسیک‌نمایِ پی‌نویس - PN²
  • Empty
  • قاطی کردم
  • مهربون
  • موفق
  • متعجب
  • مریض
  • مشغول
  • معترض
  • ناراحت
  • هیچ
  • کنجکاو
  • کسل
  • گیج شدم
  • گریه
  • پکر
  • اخمو
  • از خود راضی
  • بی تفاوفت
  • بد جنس
  • بد حال
  • خونسرد
  • خواب آلود
  • خوشحال
  • خجالتی
  • خسته
  • دلواپس
  • رنجور
  • ریلکس
  • سپاسگزار
  • سر به زیر
  • شوکه
  • شاد و سر حال
  • عاشق
  • عصبانی
  • غمگین
  • غافلگیر
  • User Tag List

    نمایش پیکها: از 1 به 10 از 14

    جُستار: نرم‌افزار پارسیک‌نمایِ پی‌نویس - PN²

    Threaded View

    1. #1
      دفترچه نویس
      Points: 471,639, Level: 100
      Level completed: 0%, Points required for next Level: 0
      Overall activity: 2.0%
      دستاوردها:
      First 1000 Experience PointsGot three Friends
      نِشان‌ها:
      Most Popular
      آغازگر جُستار
      سرور خویـشتـن
       
      Empty
       
      Mehrbod آواتار ها
      تاریخ هموندی
      Oct 2010
      ماندگاه
      لاجیکستان
      نوشته ها
      8,712
      جُستارها
      188
      امتیازها
      471,639
      رنک
      100
      Post Thanks / Like
      سپاس
      12,116
      از ایشان 21,650 بار در 7,581 پست سپاسگزاری شده است .
      یافتن همه‌یِ سپاسهای گرفته شده
      یافتن همه‌یِ سپاسهای داده شده
      Mentioned
      62 Post(s)
      Tagged
      1 Thread(s)

      نرم‌افزار پارسیک‌نمایِ پی‌نویس - PN²

      نرمافزار PârsikNemâye PeyNevis یا PN² یک برنامه برای شناسایی خودکار واژگان پارسیک و برچسب زدن آنها میباشد.

      نرم‌افزار به زبان Python نوشته شده و از این فندآوری‌ها[1] میبهرد[2]:


      از آنجاییکه port کردن برنامه برای همگان کارِ دشوار و زمانبری است, چندتایی از راهکارهایی که پیشتر در آورده‌ام را اینجا میگذارم, شاید به کار دیگران بیایند.


      unipers/mapped_chars.ini

      کد:
      آ	â
      ا	a
      ب	b
      پ	p
      ت	t
      ث	s
      ج	j
      چ	c
      ح	h
      خ	x
      د	d
      ذ	z
      ر	r
      ز	z
      ژ	ž
      س	s
      ش	š
      ص	s
      ض	z
      ط	t
      ظ	z
      ع	å
      غ	q
      ف	f
      ق	q
      ک	k
      گ	g
      ل	l
      م	m
      ن	n
      #و	ů
      و	v
      ه	h
      ی	y
      ء	$
      آ	â
      اً	$
      هٔ	$
      ة	$
      ٸ	'
      ترانویس‌ها (هیچکدام ١٠٠% درست کار نمیکند)
      کد:
      _unimapped     =   {}
      with open('unipers/mapped_chars.ini','r',encoding='utf-8') as file:
        lines = sorted(file.read().split('\n'), key=lambda l: l.split('\t')[0])
      for line in lines:
          if line.count('\t') == 0 or line.startswith('#'): continue
          a, b = line.split('\t')[1], line.split('\t')[0]
          if a in _unimapped: continue
          _unimapped[a] = b
      _unimapped['i'] = 'ی'
      _unimapped['u'] = 'و'; _unimapped['v'] = 'و'; _unimapped['w'] = 'و'
      _unimapped[' '] = ' '
      _unimapped.update({c:c for c in string.punctuation})
      
      def stripvowels(word):
        return re.sub('(ِ|ُ|َ|ْ|ّ)+', '', word)
      
      def unipers2roman(word, reverse=False):
        mapped = bidict({'x':'kh', 'ž':'zh', 'š':'sh', 'c':'ch'})
        for k, v in (mapped.items() if not reverse else mapped.inv.items()):
          word = word.replace(k, v)
        return word
      
      def unipers2perso(word, vowels=False, hint=None):
        if len(word) == 0: return ''
        ret = ''
        _vowels = {'e':'ِ', 'o':'ُ', 'a':'َ'}
        mfaced = 't z s h'.split()
        mfaces = {
          't':'ت ط'.split(),
          'z':'ز ذ ض ظ'.split(),
          's':'س ص ث'.split(),
          'h':'ه ح'.split(),
          }
        idx = 0
        for idx, c in enumerate(word.lower()):
          if idx < len(word) -1 and c == 'i' and word[idx+1] == 'y':
            continue
          if idx == 0 and c in ['i']: ret += 'ای'
          elif idx == 0 and c in ['u']: ret += 'او'
          elif idx == 0 and c in ['e', 'o', 'a']: ret += 'ا'
          elif c in ['e', 'o', 'a'] and idx > 0:
            if c in ['a'] and (word[idx-3:idx] in ['pas'] or word[idx-1] in ['i']): ret += 'ا'
            elif c in ['o'] and re.match('o(.udan|dâ)', word[idx:]): pass
            elif c in ['o'] and re.match('o([z])?ir', word[idx:]): pass
            elif c in ['o'] and idx < len(word)-2 and word[idx+1] in ['â','g','k','l','d', 'b', 'z']: ret += 'و'
            if vowels: ret += _vowels[c]
          else:
            if c in mfaced:
              if hint and idx < len(hint):
                l = mfaces[c]
                indices = sorted(filter(lambda x: x[0] > -1, ((hint.find(ch, idx), ch,) for ch in l)), key=lambda x: x[0])
                if indices:
                  idx = indices[0][0]
                  ret += indices[0][1] if idx < len(hint) else l[0]
                else:
                  ret += l[0]
              else:
                ret += mfaces[c][0]
            elif c in ['e']: ret += 'ع'
            else: ret += _unimapped[c]
          if idx == len(word)-1 and c in ['a', 'e']: ret += 'ه'
          elif c in ['â']:
            if idx < len(word)-2 and word[idx+1] == 'i': ret += 'ی'
          elif c in ['e'] and not re.search('(.{1,3})(udan|â|uxtan|uz|stan)', word[idx:]):
            if idx == len(word)-1: ret += 'ه'
            elif idx < len(word) -1:
              if word[idx+1] in ['a', 'â', 's', 'p']: ret += 'ه' + '\u200c'
              elif word[idx+1] in ['i']: ret += 'ه' + '\u200cا'
        ret = ret[0] + ret[1:].replace('آ','ا')
        for c in ret:
          if c in ['ی','ن','و']: continue
          ret = re.sub('%s+' % re.escape(c),c, ret)
        return ret
      گرفتن بن کنون از کارواژه[3]:

      augment_verb_exceptions.ini:
      کد:
      #Exception_Forms
      zistan ziv
      bihudan bihun
      کد:
      v_exceptions = dict(verb.split() for verb in filter(None, fread('augment_verb_exceptions.ini').splitlines()[1:]))
      
      def konundis(verb):
        "Âhanješe bone konun az kârvâže"
        global v_exceptions
        prefix = ""
        if isinstance(verb, Word):
          if verb.roots:
            if verb.roots_into_verb:
              verb = ''.join(verb.roots[verb.roots_into_verb:]).lower()
            else:
              prefix = ''.join(verb.roots[:-1]).lower()
              verb = verb.roots[-1].lower()
            if verb in ['idan', 'dan']: return prefix
          else: verb = verb.text
        ret = jahanshiri((prefix+verb).lower())
        if len(ret) > 0: prefix = ''
        else:
          ret = jahanshiri(verb.lower())
        if len(ret) > 0: return prefix + ret
        else: ret = None
        if verb in v_exceptions:
          return prefix+v_exceptions[verb]
        mapped = [
          ['(.*?)oftan', '%sub'],
          ['(.*?)aftan', '%sâv'], ['(.*?)âftan', '%sâb'], ['(.*?)eftan', '%sev'], ['(.*?)ftan', '%sb'],
          ['(.*?)eštan', '%sis'],
          ['(.*?)aštan', '%sard'],
          ['(.*?)(štan|štân)', '%sr'],
          ['(.{1,3})astan', '%san'],
          ['(.*?)xtan', '%sz'],
          ['(.*?)udan', '%sâ'],
          ['(.*?)ostan', '%su'],
          ['(.{1,2})idan', '%sin'],
          ['(.{1,2})stan', '%ss'],
          ['(.*?)(adan|yidan|idan|âdan|dan|estan|stan|tan)', '%s'],
        ]
      
        for dis, fmt in mapped:
          if re.match(dis, verb):
            ret = fmt % re.match(dis, verb).groups()[0]
            break
      
        assert ret, "Kârvâžeye nâšenâxte: '%s'" % verb
        return prefix + ret
      
      def gozaštedis(verb):
        "Âhanješe bone gozašte az kârvâže"
        return verb[:-2]
        
      def jahanshiri(verb):
        "Gereftane konundis az jahanshiri.com"
        ret = ''
        url = 'http://www.jahanshiri.ir/pvc/conjpl.php?verb=%s&lang=en'
        tries = 0
        while True:
          try:
            page = tor.download(url % unipers2roman(verb).replace('â', '%C3%A2'))[0]
            break
          except Exception as ex:
            if tries > 3: break
            tries += 1
        assert page, "Download failed for '%s'" % verb
        if page.find('present stem') == -1: return ret
        ret = re.search('[/td][/tr][tr](?:[td].*?[/td]){2}[td](.*?)[/td]', page).groups()[0]
        ret = unipers2roman(ret, reverse=True)
        return ret










      ----
      1. ^ fand+âvar+i::Fandâvari || فنداوری: تکنولوژی Ϣiki-En technology
      2. ^ Bahridan || بهریدن: بهره جستن; استفاده کردن Ϣiki-En to utilize; to use
      3. ^ kâr+vâže::Kârvâže || کارواژه: فعل Dehxodâ verb

      Sticky بجای وادادن در برابر واقعیت تلخ، بهتر است آدمی بكوشد كه واقعیت را بسود خود دگرگون كند و اگر بتواند حتی یك واژه ی تازی را هم از زبان شیرین مادری خود بیرون بیندازد بهتر از این است كه بگوید چه كنم ! ناراحتم! ولی همچنان در گنداب بماند و دیگران را هم به ماندن در گنداب گول بزند!!

      —مزدک بامداد


    2. 4 کاربر برای این پست سودمند از Mehrbod گرامی سپاسگزاری کرده اند:

      Russell (05-03-2013),sonixax (05-03-2013),Sotude (05-04-2013),Spehr (12-09-2013)

    داده‌های جُستار

    کاربری که سرگرم دیدن این جُستار هستند

    هم‌اکنون 1 کاربر سرگرم دیدن این جُستار است. (0 کاربر و 1 مهمان)

    جُستارهای همانند

    1. پاسخ: 22
      واپسین پیک: 04-17-2014, 03:53 PM
    2. پاسخ: 31
      واپسین پیک: 08-14-2012, 08:37 PM
    3. کدام سرویس وبلاگدهی امن تر است.
      از سوی sonic در تالار رایانه، اینترنت، تلفن‌های همراه
      پاسخ: 5
      واپسین پیک: 04-26-2012, 10:29 PM

    کلیدواژگان این جُستار

    مجوز های پیک و ویرایش

    • شما نمیتوانید جُستار نوی بفرستید
    • شما نمیتوانید پیکی بفرستید
    • شما نمیتوانید فایل پیوست کنید.
    • شما نمیتوانید پست های خود را ویرایش کنید
    •