-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding Rust parser * fix formatting issues
- Loading branch information
Showing
8 changed files
with
286 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
as | ||
async | ||
await | ||
block | ||
bool | ||
break | ||
char | ||
const | ||
continue | ||
crate | ||
default | ||
dyn | ||
else | ||
enum | ||
expr | ||
extern | ||
f32 | ||
f64 | ||
false | ||
fn | ||
for | ||
i128 | ||
i16 | ||
i32 | ||
i64 | ||
i8 | ||
ident | ||
if | ||
impl | ||
in | ||
isize | ||
item | ||
let | ||
lifetime | ||
literal | ||
loop | ||
macro_rules! | ||
match | ||
meta | ||
mod | ||
move | ||
mut | ||
pat | ||
path | ||
pub | ||
ref | ||
return | ||
self | ||
static | ||
stmt | ||
str | ||
struct | ||
super | ||
trait | ||
true | ||
tt | ||
ty | ||
type | ||
u128 | ||
u16 | ||
u32 | ||
u64 | ||
u8 | ||
union | ||
unsafe | ||
use | ||
usize | ||
vis | ||
where | ||
while | ||
yield |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from codebleu import calc_codebleu | ||
|
||
#prediction = "def add ( a , b ) :\n return a + b" | ||
#reference = "def sum ( first , second ) :\n return second + first" | ||
#result = calc_codebleu([reference], [prediction], lang="python", weights=(0.25, 0.25, 0.25, 0.25), tokenizer=None) | ||
#print(result) | ||
|
||
# { | ||
# 'codebleu': 0.5537, | ||
# 'ngram_match_score': 0.1041, | ||
# 'weighted_ngram_match_score': 0.1109, | ||
# 'syntax_match_score': 1.0, | ||
# 'dataflow_match_score': 1.0 | ||
# } | ||
|
||
# prediction = "void add (int a ,int b ) {\n return a + b;}" | ||
# reference = "void sum ( int first , int second ) {\n return second + first;}" | ||
# result = calc_codebleu([reference], [prediction], lang="c", weights=(0.25, 0.25, 0.25, 0.25), tokenizer=None) | ||
# print(result) | ||
|
||
prediction = "fn add ( a , b )->i8 {\n a + b}" | ||
reference = "fn sum ( first , second )->i8 {\n second + first}" | ||
result = calc_codebleu([reference], [prediction], lang="rust", weights=(0.25, 0.25, 0.25, 0.25), tokenizer=None) | ||
print(result) | ||
|