Comments (4)
@gustavoasoares It looks like the first child's id is 6, not 1. WTF?
from refazer.
In this test case:
foreach (var string_int_tuple in examples_strings_and_ints)
{
var rootNode = NodeWrapper.Wrap(ASTHelper.ParseContent(string_int_tuple.Item1));
rootNode.PrintTree();
var extractedNode = rootNode.Find(string_int_tuple.Item2);
examples.Add(Tuple.Create(rootNode, extractedNode));
}
Here are the results of rootNode.PrintTree()
:
First example's AST, with NodeIDs:
1
SuiteStatement(){ AssignmentStatement(){ NameExpression(i) literal(0) } }
2
AssignmentStatement(){ NameExpression(i) literal(0) }
3
NameExpression(i)
4
literal(0)
Second example's AST, with NodeIDs:
6
SuiteStatement(){ AssignmentStatement(){ NameExpression(j) literal(1) } }
7
AssignmentStatement(){ NameExpression(j) literal(1) }
8
NameExpression(j)
9
literal(1)
@gustavoasoares why does your NodeWrapper not restart it's counting? How do I ask it to do so?
from refazer.
So, it seems that this is the problem: When I repeatedly wrap each example AST, the counter IdCount
is not reset. Is there any problem with resetting it?
public abstract class PythonNode
{
public static int IdCount = 0;
protected InsertStrategy InsertStrategy { set; get; }
public int Id { get; set; }
public dynamic Value { get; set; }
public Node InnerNode { get;}
public List<PythonNode> Children { get; set; }
public PythonNode Parent { get; set; }
public bool Reference { get; set; }
public PythonNode(Node innerNode)
{
Id = IdCount++;
InnerNode = innerNode;
Children = new List<PythonNode>();
Reference = false;
}
from refazer.
Found a way around this. Still annoying, but not a blocker.
from refazer.
Related Issues (20)
- Refactor test cases to use new Refazer API HOT 4
- Refactor and Document witness functions
- Refactor DSL semantics HOT 1
- update Refazer to use the new prose API HOT 2
- Difficulty compiling; apparent package update and namespace issues HOT 23
- Add extraction-only (subset of transformation) option to Refazer HOT 1
- What is the purpose of this function? It's causing an error HOT 1
- What does this line do? HOT 1
- What's the difference between a PythonNode and a ProgramNode? HOT 2
- Why is Farbindn learning nothing (returning null)? HOT 7
- Test how well learned extraction programs generalize to new examples HOT 2
- my Find mode is failing to find nodes that are obviously there. HOT 1
- Learn extraction programs from multiple examples HOT 4
- Change interface so that I can give Farbindn substrings instead of node ids as training examples HOT 1
- be able to use Farbindn as a "webservice" for a webapp
- Read in a folder of py files, borrowing code from my additions to the PROSE code base
- write function that finds smallest node that contains code between two offsets
- how to install or use refazer on linux HOT 1
- The tutorial in the Readme doesnt work for me
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from refazer.