1,a) 2,b) 1,c) 1,d) 1,) 1,f) Tr-to-String 1.,.,,., [1], [2].,,,, 1.,,,. 1, 1, 1 Nara Institut of Scinc and Tchnology 2 Shinshu Univrsity a) oda.yusuk.on9@is.naist.jp b) dlihiros@gmail.com c) nubig@is.naist.jp d) ssakti@is.naist.jp ) tomoki@is.naist.jp f) s-nakamura@is.naist.jp input 1 (Python) : if x % 5 == 0: output 1 (Commnt): # x 5 input 2 (Python) : y = x / 5 output 2 (Commnt): # y x 5 1 Python., [3], [4], [5] [6].,., (, ),,.,,.,,,., c 2014 Information Procssing Socity of Japan 1
, Tr-to-String,.,, Tr-to-String.,. Python vr.3.,. 2. 2.1 [7], f ê (1). ê := arg max Pr( f) (1) f = f f 1 = [f 1, f 2,, f f ], = 1 = [ 1, 2,, ]. f., f ( ) [8], [9], Tr-to-String [10]. Tr-to-String,. 2.2 Tr-to-String f,. T f.,., [11]. Tr-to-String., (1), Tr-to-String. ê := arg max Pr( f) 2 = arg max arg max Tr-to-String Pr( f, T f )Pr(T f f) T f T f Pr( T f )Pr(T f f) (2) arg max Pr( Tf ) (3) Tr-to-String, 2,,. 2,., d. d, Tr-to-String. Pr( T f ), (4) d. d D Pr( T f ) := xp (w ϕ(t f,, d)) d D xp (w ϕ(t f,, d)) (4) D, ϕ d, w. ϕ,. Pr(T f f) f T f.,,. (3), Trto-String Tf = arg max Pr(T f f), T f., c 2014 Information Procssing Socity of Japan 2
., (2) [12]. 2.3 Tr-to-String Tr-to-String (1), (2), (3). 2.3.1,.., 2., [13], [14], [15]. 2.3.2,. GHKM [16]., ϕ,. 2.3.3, w [17]. 3., Tr-to-String.,.,.,,., Tr-to-String. Tr-to-String. 3.1,.,. Python,., if,.,.,, 1,. 3.2 3.1, Tr-to-String.,,. 3, if x is divisibl by 5 (a), Python if x % 5 == 0: (b). Ckylark *1, Python ast. x 5., Python. 3(b) Load,,. if,. Tr-to-String 2.3,,. 3,, 3(b)., Load,. *1 http://odamon.com/?pag=tools ckylark c 2014 Information Procssing Socity of Japan 3
1 Python : pass if a == b: if a == b:pass df foo(a, b, c): df foo(a, b, c):pass lif if Tru:pass\n lif foo(): if Tru:pass\nlif foo():pass ls ls: if Tru:pass\nls:pass xcpt try:pass\n xcpt: try:pass\nxcpt:pass 3,,.,.,, [18], [19], [20]., Tr-to-String,,.. 3.3, Python. (1), (2) 2, (3). 3.3.1 3(b) if,,., [21].,.,,. [21].,.,. 3(b) 4. 3.3.2,. 4,., c 2014 Information Procssing Socity of Japan 4
2 (Nam... (id (str x))...) (Nam x) (Num... (n (int x))...) (int x) (BinOp... (lft x) (op y) (right z)...) (BinOp (lft x) (right z) (op y)) (Compar... (lft x) (ops y) (comparators z)...) (Compar (lft x) (comparators z) (ops y)) 4 5,,.,., 20. 2., 4 5. 3(b) 5,,. 3.3.3,.,,. if x % 5 == 0: x 5, x 5,. 0,. 3,,.,. 6.,,. 6 x 5, 0, NAME1, INT1, INT2.,,.,,.,.,, Tr-to-String.. 3.4, 2.3 Tr-to-String c 2014 Information Procssing Socity of Japan 5
6,.. 4. : Python 4.1 Tr-to-String,. Python [22]. *2 Python 3., 722, Python, 1. 4. Tr-to-String 1,.,. 4.2 7,., Tr-to-String. (1). (2) ( ),. *2 https://projctulr.nt/ MCab[23]. MCab, ASCII,. foo _ bar 1-3. (3) Python 3.1,. Python ast. (4) (3), 3.3. (5) (2) (4),. (6) (5),. (invrsion transduction grammar: ITG) pialign[15]. ( ) 10.,, 80. (7) (5).,. n-gram KnLM[24], 5-gram. (8)Tr-to-String c 2014 Information Procssing Socity of Japan 6
7 Tr-to-String,,,, Tr-to-String. GHKM [16] Travatar[25].. 3 Accptability 5 (AA),. 4 (A),. 3 (B),. 2 (C),. 1 (F),. 4.3,.. raw,, Python ast. had,. rducd,,. constraind,.,,. 4.4,.,. BLEU[26] RIBES[27]. n-gram, BLEU, RIBES., 0, 1. Accptability[28]. 3 5,. 5. 4 BLEU % RIBES % raw 54.94 86.94 had 60.00 88.96 rducd 63.69 89.77 constraind 56.92 87.46 5 Accptability Accptability raw 3.812 had 4.039 rducd 4.155 constraind 4.174 5.1 4,., 9, 1 10, 10. BLEU, RIBES rducd ( +), had ( ), raw ( ).,., constraind( ++).,. c 2014 Information Procssing Socity of Japan 7
5.2 8 Accptability 5 Accptability. 8, Accptability. Accptability,, rducd constraind 70%,. raw, Tr-to-String,., rducd, had, raw,., constraind rducd. constraind,,. 8, Accptability 5( ) 1().,,. 6. 6.1 6, 2 if x % 5 == 0: if x % 5 == 1:., 1 1, 0. 0.,,, Tr-to-String,.. constraind,.,.,,. 4, 5. constraind,,. Tr-to-String, Tr-to-String [12]. 7. Tr-to-String,.,., 1,.,.,,.,, Python.,., c 2014 Information Procssing Socity of Japan 8
Python if x % 5 == 0: if x % 5 == 1: raw x 5 x 5 1 had x 5 x 5 1 rducd x 5 x 5 1 constraind x 5 0 x 5 1 6 [20],.,.,,.,,,.,. [1] DLin, R., Vnolia, G. and Rowan, K.: Softwar Dvlopmnt with Cod Maps, Commun. ACM, Vol. 53, No. 8, pp. 48 54 (2010). [2] Rahman, M. M. and Roy, C. K.: SurfClips: Contxt- Awar Mta Sarch in th IDE, Proc. ICSME, pp. 617 620 (2014). [3] Sridhara, G., Hill, E., Muppanni, D., Pollock, L. and Vijay-Shankr, K.: Towards automatically gnrating summary commnts for Java mthods, Proc. ASE, pp. 43 52 (2010). [4] Bus, R. P. and Wimr, W. R.: Automatic Documntation Infrnc for Excptions, Proc. ISSTA, pp. 273 282 (2008). [5] Sridhara, G., Pollock, L. and Vijay-Shankr, K.: Automatically Dtcting and Dscribing High Lvl Actions Within Mthods, Proc. ICSE, pp. 101 110 (2011). [6] Wong, E., Yang, J. and Tan, L.: AutoCommnt: Mining qustion and answr sits for automatic commnt gnration, Proc. ASE, pp. 562 567 (2013). [7] Brown, P. F., Pitra, V. J. D., Pitra, S. A. D. and Mrcr, R. L.: Th mathmatics of statistical machin translation: Paramtr stimation, Computational Linguistics, Vol. 19, No. 2, pp. 263 311 (1993). [8] Kohn, P., Och, F. J. and Marcu, D.: Statistical phras-basd translation, Proc. NAACL-HLT, pp. 48 54 (2003). [9] Chiang, D.: Hirarchical phras-basd translation, Computational Linguistics, Vol. 33, No. 2, pp. 201 228 (2007). [10] Huang, L., Knight, K. and Joshi, A.: Statistical syntaxdirctd translation with xtndd domain of locality, Proc. AMTA, Vol. 2006, pp. 223 226 (2006). [11] Nubig, G. and Duh, K.: On th Elmnts of an Accurat Tr-to-String Machin Translation Systm, Proc. ACL, Baltimor, USA (2014). [12] Mi, H., Huang, L. and Liu, Q.: Forst-Basd Translation, Proc. ACL-HLT, Columbus, Ohio, pp. 192 199 (2008). [13] Brown, P. F., Pitra, V. J. D., Pitra, S. A. D. and Mrcr, R. L.: Th Mathmatics of Statistical Machin Translation: Paramtr Estimation, Computational Linguistics, Vol. 19, No. 2, pp. 263 311 (1993). [14] Och, F. J. and Ny, H.: A Systmatic Comparison of Various Statistical Alignmnt Modls, Computational Linguistics, Vol. 29, No. 1, pp. 19 51 (2003). [15] Nubig, G., Watanab, T., Sumita, E., Mori, S. and Kawahara, T.: An Unsuprvisd Modl for Joint Phras Alignmnt and Extraction, Proc. ACL-HLT, Portland, Orgon, USA, pp. 632 641 (2011). [16] Gally, M., Hopkins, M., Knight, K. and Marcu, D.: What s in a Translation Rul?, Proc. NAACL-HLT, pp. 273 280 (2004). [17] Och, F. J.: Minimum Error Rat Training in Statistical Machin Translation, Proc. ACL, Sapporo, Japan, pp. 160 167 (2003). [18] Isozaki, H., Sudoh, K., Tsukada, H. and Duh, K.: Had Finalization: A Simpl Rordring Rul for SOV Languags, Proc. WMT, Uppsala, Swdn, pp. 244 251 (2010). [19] Hatakoshi, Y., Nubig, G., Sakti, S., Toda, T. and Nakamura, S.: Rul-basd Syntactic Prprocssing for Syntax-basd Machin Translation, Proc. SSST, Doha, Qatar, pp. 34 42 (2014). [20] Burktt, D. and Klin, D.: Transforming Trs to Improv Syntactic Convrgnc, Proc. EMNLP, Jju Island, South Kora (2012). [21] Li, P., Liu, Y. and Sun, M.: An Extndd GHKM Algorithm for Inducing λ-scfg, Proc. AAAI (2013). [22] Vol. 2014, No. 22, pp. 1 8 (2014). [23] Kudo, T., Yamamoto, K. and Matsumoto, Y.: Applying Conditional Random Filds to Japans Morphological Analysis., Proc. EMNLP, Vol. 4, pp. 230 237 (2004). [24] Hafild, K., Pouzyrvsky, I., Clark, J. H. and Kohn, P.: Scalabl Modifid Knsr-Ny Languag Modl Estimation, Proc. ACL, Sofia, Bulgaria, pp. 690 696 (2013). [25] Nubig, G.: Travatar: A Forst-to-String Machin Translation Engin basd on Tr Transducrs, Proc. ACL, Sofia, Bulgaria, pp. 91 96 (2013). [26] Papinni, K., Roukos, S., Ward, T. and Zhu, W.-J.: BLEU: A Mthod for Automatic Evaluation of Machin Translation, Proc. ACL, pp. 311 318 (2002). [27] Isozaki, H., Hirao, T., Duh, K., Sudoh, K. and Tsukada, H.: Automatic Evaluation of Translation Quality for Distant Languag Pairs, Proc. EMNLP, pp. 944 952 (2010). [28] Goto, I., Chow, K. P., Lu, B., Sumita, E. and Tsou, B. K.: Ovrviw of th patnt machin translation task at th NTCIR-10 workshop, NTCIR-10 (2013). c 2014 Information Procssing Socity of Japan 9