  Throughout this paper we present a new method to detect and measure emission
lines in J-PAS up to $z = 0.35$. J-PAS will observe $8000$~deg$^2$ of the
northern sky in the upcoming years with 56 photometric bands. The release of
such amount of data brings us the opportunity to employ machine learning
methods in order to overcome the difficulties associated with photometric data.
We used Artificial Neural Networks (ANNs) trained and tested with synthetic
J-PAS photometry from CALIFA, MaNGA, and SDSS spectra. We carry out two tasks:
firstly, we cluster galaxies in two groups according to the values of the
equivalent width (EW) of $H\alpha$, $H\beta$, $[NII]{\lambda 6584}$, and $
[OIII]{\lambda 5007}$ lines measured in the spectra. Then, we train an ANN to
assign to each galaxy a group. We are able to classify them with the
uncertainties typical of the photometric redshift measurable in J-PAS.
Secondly, we utilize another ANN to determine the values of those EWs.
Subsequently, we obtain the $[NII]/H\alpha$, $[OIII]/H\beta$, and
\ion{O}{3}\ion{N}{2} ratios recovering the BPT diagram . We study the
performance of the ANN in two training samples: one is only composed of
synthetic J-PAS photo-spectra (J-spectra) from MaNGA and CALIFA (CALMa set) and
the other one is composed of SDSS galaxies. We can reproduce properly the main
sequence of star forming galaxies from the determination of the EWs. With the
CALMa training set we reach a precision of 0.093 and 0.081 dex for the
$[NII]/H\alpha$ and $[OIII]/H\beta$ ratios in the SDSS testing sample.
Nevertheless, we find an underestimation of those ratios at high values in
galaxies hosting an AGN. We also show the importance of the dataset used for
both training and testing the model. ANNs are extremely useful to overcome the
limitations previously expected concerning the detection and measurements of
the emission lines in surveys like J-PAS.
