Samuel Sloniker
2 years ago
3 changed files with 95 additions and 0 deletions
@ -0,0 +1,50 @@
|
||||
import timeit |
||||
import gptc |
||||
import json |
||||
import sys |
||||
|
||||
compile_iterations = 100 |
||||
classify_iterations = 10000 |
||||
|
||||
with open("models/raw.json") as f: |
||||
raw_model = json.load(f) |
||||
|
||||
with open("models/benchmark_text.txt") as f: |
||||
text = f.read() |
||||
|
||||
classifier = gptc.Classifier(gptc.compile(raw_model)) |
||||
|
||||
print("Benchmarking GPTC on Python", sys.version) |
||||
|
||||
print( |
||||
"Average compilation time over", |
||||
compile_iterations, |
||||
"iterations:", |
||||
round( |
||||
1000000 |
||||
* timeit.timeit( |
||||
"gptc.compile(raw_model)", |
||||
number=compile_iterations, |
||||
globals=globals(), |
||||
) |
||||
/ compile_iterations |
||||
), |
||||
"microseconds", |
||||
) |
||||
|
||||
|
||||
print( |
||||
"Average classification time over", |
||||
classify_iterations, |
||||
"iterations:", |
||||
round( |
||||
1000000 |
||||
* timeit.timeit( |
||||
"classifier.classify(text)", |
||||
number=classify_iterations, |
||||
globals=globals(), |
||||
) |
||||
/ classify_iterations |
||||
), |
||||
"microseconds", |
||||
) |
@ -0,0 +1,35 @@
|
||||
Friends, Romans, countrymen, lend me your ears; |
||||
I come to bury Caesar, not to praise him. |
||||
The evil that men do lives after them; |
||||
The good is oft interred with their bones; |
||||
So let it be with Caesar. The noble Brutus |
||||
Hath told you Caesar was ambitious: |
||||
If it were so, it was a grievous fault, |
||||
And grievously hath Caesar answer'd it. |
||||
Here, under leave of Brutus and the rest- |
||||
For Brutus is an honourable man; |
||||
So are they all, all honourable men- |
||||
Come I to speak in Caesar's funeral. |
||||
He was my friend, faithful and just to me: |
||||
But Brutus says he was ambitious; |
||||
And Brutus is an honourable man. |
||||
He hath brought many captives home to Rome |
||||
Whose ransoms did the general coffers fill: |
||||
Did this in Caesar seem ambitious? |
||||
When that the poor have cried, Caesar hath wept: |
||||
Ambition should be made of sterner stuff: |
||||
Yet Brutus says he was ambitious; |
||||
And Brutus is an honourable man. |
||||
You all did see that on the Lupercal |
||||
I thrice presented him a kingly crown, |
||||
Which he did thrice refuse: was this ambition? |
||||
Yet Brutus says he was ambitious; |
||||
And, sure, he is an honourable man. |
||||
I speak not to disprove what Brutus spoke, |
||||
But here I am to speak what I do know. |
||||
You all did love him once, not without cause: |
||||
What cause withholds you then, to mourn for him? |
||||
O judgment! thou art fled to brutish beasts, |
||||
And men have lost their reason. Bear with me; |
||||
My heart is in the coffin there with Caesar, |
||||
And I must pause till it come back to me. |
Loading…
Reference in new issue